Forms :: Number Of Buttons Which Open Other Forms And Filter Results Using Embedded Macro
Apr 6, 2015
I have a bit of a problem with a database in Access 2013. On 1 of the forms, I have a number of buttons which open other forms and filter the results using an embedded macro. All has been well until a few days ago when error 2950 pop up box started appearing. After fiddling around for a while it all works OK (without actually changing anything) until next time the database is opened. I checked to make sure the location is "trusted" and all seems OK.
I've been developing a new db and have been adding buttons to forms all along without any issue.
I would create a button and under the event tab in the properties sheet all the buttons used to indicate "On Click" would produce an [Event Procedure]. Suddenly the "On Click" now indicates an [Embedded Macro] is going to run, which is not what I really want to have happen......
I'm trying to create a simple embedded macro for a checkbox control on a form [Company?]. The default value for this checkbox is No.
I want to write an If statement that basically says "If[Company?] = Yes, then GotoControl[CompanyorNameCombo], Else GotoControl[CustomerFN]
Although the checkbox field label and the control itself IS named [Company?] in the table and set as a Yes/No field, when I try to write the If statement I get an error that says "Microsoft Access cannot find the name 'Company?' you entered in the expression"
That's the name of the control and it is included in the table and shows in the field list.
I am working on a database to hold the data regarding our company vehicles. I have a table for the details of the vehicle (i.e Registration, VehicleType, Drivername etc) and a number of tables for different types of equipment (AccessEquipment, LiftingEquipment, StandardEquipment and others).
I have a form that runs on a query with the criteria to search for the registration number. I have also set up forms to show each type of equipment to use as sub-forms. I would like to have on this main form a number of command buttons that would open the specific sub-form on the main form.
How can I do this? Any ideas would be greatly appreciated?
I am using Microsoft Access 2010. It provides great filtering and sorting options in the ribbon for any object. But what if I hide the ribbon and want to create custom buttons on the form to do the filtering and sorting job? There are some filter options available in macros but are not quite like the ribbon's own Filter button. When the Filter button is clicked from the Robbin, a filter menu pops-up under the active field, which doesn't happen when I try to do it using Macro functions like "Apply Filter" or "Set Filter" etc. I want to have that big "FILTER" button from the Ribbon on my form.
I am using MS Acess2000 and need to make a report that will be passed around with production work. My primary key is the invoice number of the work order. Currently to open an invoice i have a macro, attached to a query with the following qualifiers; Like [Enter invoice]
This pulls up the current record fine. for the form and flags the folloing in the property filter sectin of the form
(((([CustomerTableMasterRef].[Invoice]) Like [Enter invoice])))
PART 2
Now I am trying to use microsofts how to filter a report using a forms filter... This picks up on the Invoice query as shown above but does not just insert the query results...
Is there better code or another way to approach this... Currently i am using:
Name:cmdOpenReport Caption: Open Report OnClick: [Event Procedure]
Private Sub CmdOpenReport_Click() If Me.Filter = "" Then MsgBox "Open an Invoice First" Else DoCmd.OpenReport "rptCustomers", acViewPreview, , Me.Filter End If End Sub
Using this code not only does my report not detect the correct fields to import data (no data is filled in) but it requerys the invoice or atleast should, which I could do with out all of that code...
I want to create a navigation form, or any form for that matter that has an embedded report. The report has data arranged by ClientID. I would like to create buttons down the left side of my form (why I thought a navigation form could work) where I can put the client name on the buttons and when I click them the report will filter to only show that clients data. I have client tables and the report data linked in queries, but just need to know how to get started with these buttons acting as ID sorters.
For example: ClientID: 1 = Client: ABC Corp
In my report ClientID 1's data is grouped along with all other client ID's.
In my form I'd like buttons down the left side with ABC Corp written on it (followed by buttons for the other clients) and then when I click the ABC Corp button only ABC Corp's data shows on the page from the embedded report...
I'm trying to implement a macro to filter through accidents to see if my company has already been hired on a particular case.
In the first form the user enters the date, location, and last name of one of the drivers. Then they click a button which opens a new form as a datasheet with accidents that match ANY of the three controls. Evidently, I need a filter that contains some form of a series of OR operators.
However, whenever I try any variation of a button that opens the second form and then applies the filter, I always get no matches.
I have a button using a macro to open a form in Hidden mode. Then I have another button on another form to open this form that was hidden.
When I open the form, the form is virtually blank apart from the form caption name. But when I close this and press the button again the form opens as normal.
I do not understand why?
I was told that once you hide the form and when you open the form again, it should appear normal. Why do I get this blank form??? Only by hitting the button again then the form is normal....
I have an access form with tab control pages each with embedded forms.In one page I have a list of records as a datasheet form with the record identifier field configured as a hyperlink. When I click on this it passes its value to a form field in the form in the following tab page (works without the hyperlink but its a useful way of highlighting which field to click) which is a display/edit form of the details of the individual record. The Subroutine which does this sets the focus on this field it is passing the value to on the other form and the 'On Got Focus' event in that triggers the query that fills the editor form.
When I click back on the following tab to select another record to view/edit, the identifier value of the other record is passed to the other form but the data displayed in the rest form doesn't change. I understand this is because the field with the 'On Got Focus' never lost focus and so the query function was not called. To correct this I tried adding the same function call to the 'On Change' event however this does not work (the field is a text box set to 'locked' if that is relevant).I can get the form to do a new query properly if I click on a different field in the form before going back to the list tab or (as this is removing the focus allowing the On Got Focus to work again) if I click on a button to select a different record (which just takes me back to the list form).
Is there any way I can get this to work without having to manually remove the focus from the problem field? I have tried setting its On Got Focus event to move the focus to another field after the query function call however this prevents the Setfocus line in the code in the previous form from working. Here is a snippet of my code below.This code is for the list form and passes a value to the editing form:
I use the follwing code to filter a report based on the listbox selection on a form. Below is the code I use, the problem it will error if the results have an apostrophe in the string.
Private Sub FilterDesc_Click() Dim strWhere As String Dim ctl As Control Dim varItem As Variant 'make sure a selection has been made If Me.ListCarrier.ItemsSelected.Count = 0 Then MsgBox "Must select at least 1 Carrier"
I have a Main form with a sub form.The main form is a customer record (form view), and the sub form is all other customers (same fields) datasheet view.I have a navigation bar to filter (using different queries) the results in the sub form
same postcode Same company (different location) everyone except Main form customer
I cannot get a different filter (Query) to show only customers whose name begins with the same letter as the customer in the main form?I have been trying Like but think I am referencing it wrong, as it prompts me to enter a value rather than using the value in the field in the main form.This is what I have in the query (of the subform)
Customer ID: <>[Forms]![NewAllCustomerListF]![CustomerID] Customer Name: Like "[Forms]![NewAllCustomerListF]![CustomerName]" & "*"
I want to open a report with the results from a filtered form.
I want to use a similar format to the attached Allene Browne search2000 as the base to filter the records initially, but not sure how to get the filtered results into a report and the most efficient way.
I have a main form (start_protocol) with an unbound subform (placeholderform).
Using a button in mainform I open a search form (search_protocol) inside the unbound form, by the code: ------------------------------------------------------------------- [placeholderform1].Visible = False [placeholderform].Visible = True Me.placeholderform.SourceObject = "SEARCH_PROTOCOL" -------------------------------------------------------------------- The search form (has a run query button) is build from a query named: search_protocol.
I want to be able, as soon as I pass the button, to have the results (from the query) inside the unbound subform, of the main form (Start_protocol).
I have a summary form with the company name,week number, week-ending automatically populated. e.g. this week is week 4 and users enter records for week 4 as the week number is automatically generated. Basically the system will just recognise today's date and generate the week number. Problem is I am trying to display previous week records and I do not know how to filter it as my week number is generated automatically, week by week. All the other forms are linked to this week number. How can I display records for a specific week that I want? say, I want to display all records for week2, etc. I am dumbfounded as I am on a learning curve with Access.
I have a BE database, that when opened, opens a form for saving the results of a query to a text file on the desktop. It works fine, if the full path is entered.
The problem is, I want this saved on any users' desktop. I did some digging and found the %userprofile% variable, which when used, gives me the error.
I understand this should work in both Windows XP and Windows 7, which are the environments the full DB will operate in. So far the "EXPORT" button on the form has the following for the code:
Code: Private Sub BTN_Export_Click() DoCmd.TransferText acExportDelim, , "QRY_ExportPublicComment", "C:UsersMark N. McAllisterDesktopPubComExp.txt" End Sub
When I tried this:
Code: Private Sub BTN_Export_Click() Dim strPath As String strPath ="%userprofile%desktopPubComExp.txt" DoCmd.TransferText acExportDelim, , "QRY_ExportPublicComment", strPath End Sub
I have two text boxes and I'm wondering how I can filter my records of my table (through my query), between two numbers on my form. So for example lets call the two text boxes Num1 and Num2, the logical process is:
Code: IF Num1 or Num2 IS empty THEN filter records with "*" ELSE IF Num1 and Num2 contain a number THEN filter records between those two numbers
SQL, Me.Filter, BETWEEN in criteria. How I can accomplish this.
I have a form with a calculated time difference between a "Start" and "Stop" time I have managed to get the correct formula however I would like to display this value in a more civilized forma as HH:MM on the example attached I have some values that appear as 4:8 and it should be 04:08.
The second problem is I need to embed this calculated value on my tblTime as doing so I can run more easily some queries.
When I'm applying a sort and filter in a form, Access is updating the Filter and Order By properties of the form, so that it is possible to re-use in conjunction with Filter on Load and Order By on Load properties. However, a consequence of this is that when the form is closed, it prompts the user whether they want to save the design of the form. I want to circumvent this as I don't want to re-use the sort and filter and I don't want to be prompted to save the design of the form.
Although I can circumvent this by closing the form using a method that doesn't prompt for saving, the additional complication here is that the form in question is in the Navigation subform of a Navigation Control. Hence when I click on a another Navigation button, it (not me) closes my current form and hence prompts me whether I want to save the design of the form (if I have been sorting and/or filtering). I can't see how to circumvent this and the prompting is resulting in unacceptable usability.
I would like to know if it is possible in Access 2007 to add a button/hyperlink where by the order number (as in the example below) is being sourced from another field [ORDNR]
i.e. replacing the 0996653 for example with a lookup to the ordernumber held in another column?!
[URL] .....
this link is one from a web url - I want to copy this in my DB.
I thought this would be pretty simple, but I cannot figure out how and wasn't able find the solution here or anyway.
I have a source form. (I can resort to having a Table with OLE Object if I must, but prefer not to.) On this source form I wish to include different things such as company logo. This will determine what logo shows up in all the reports, so all the reports will have an image linking back to this embedded image on the source form.
Pseudo-code Example: frmSource contains imgLogo rptSample contains an image whose control source = Forms!frmSource!imgLogo
How can I do this or achieve the same effect in a more-or-less simple way?
I am using Access 2007 with Windows XP. I have a scatter chart embedded in a form that is plotting data from a subform with a trendline that is extracted and used on the form for calculations. After having the table set up correctly and running fine, I closed the database and then reopened it to have the table plotting the data in a made up 1 to 1 relationship rather than what is in the datasheet. The only way I have been able to fix this error is to change the chart type to something else then back to a scatter plot and remake the trendline. Why this is happening and how to prevent it?
Where can I find the Hex or RGB value for the blue colour that Access 2010 uses by default for buttons on forms? I need to change some buttons to yellow (I know the code for that) but later change them back to the previous shade of blue, which is shown in the Properties pane "Accent 1, Lighter 40%".
By clicking in the standard colors area at the bottom of the colour chooser I can find a very similar blue #D6DFEC but it doesn't look quite right. And the "accent" colour does not give me a Hex value.Is that "usual" blue even one colour? How can I reset a button to that style having changed it?
In a form I have a button which creates (in preview) an outlook message with a pdf report. It opens and displays just as I want it to, but if I chose to save that message in outlook and either send or cancel (i.e. allowing user to save to drafts and send later) then MS Access crashes.To ensure this wasn't to do with any compile / corruption within my full application I mirrored the process in a very simple 1 table / 1 form / 1 report db and still the same - access crashes after saving the outlook message and either sending the message or cancelling out the message.
Form code is as follows;Private Sub Command0_Click() On Error Resume Next DoCmd.SendObject acSendReport, "Table1", acFormatPDF, "someemaddress", , , , "REQUEST FOR INFORMATION" DoEvents On Error GoTo 0 End Sub
In my main application this process is embedded within a loop to send various filters of the report to different recipients, which works fine if 'save' is not used within Outlook..