I created a form to choose records by last name. After selecting the name with a combo box, I want the command button to open a report with just that record (or those records) showing. When it opens the report, all the records are showing. I don't know how to filter the query associated with the report so that it selects according to the selection in the combo box (Access 2010). Thanks for any help!
Can't Print Filtered Report
Collapse
X
-
The query that your report is based on needs to have a WHERE clause that matches up your Last Name field to the combo box. To reference the control, the syntax isCode:Forms![I]Form_Name[/I]![I]ControlName[/I]
-
That worked great in the query. The query AND the report work great, what I can't get to work is the command button on my search form. I select a name from the drop down box (combo) on my search form, then I click the command button, which I want to open the report based on the name now showing in the combo box, but it just brings up and empty report form...what am I doing wrong with that command button?Comment
-
Hard to say since I can't see your code. Please provide your entire button's OnClick event code (using Code tags. See Before Posting (VBA or SQL) Code).Comment
-
If you go into go into design view of your form and click on your button, open the properties window and go to the Events tab. Does the On Click event say Event Procedure or Event Macro? Click on it and then click on the elipsis button (the three dots). This will either open the VBA editor or the Macro editor. Either way, it will take you to what is opening the form, which is what I'm after.Comment
-
Okay. Before I have you delete the macro (to use VBA instead), can you list the commands in the macro so that we can make sure that all the functions of the macro are performed when we use VBA?Comment
-
I need the information from the macro. Can you tell me all the commands in the macro? For exampleCode:OpenReport Report Name ... View... Filter Name... Where Condition = ... Window Mode...
Comment
-
eye707:
You will be posting code to this thread so you may want to have this thread open and scrolled down to the reply box
Please open the macro in design mode.
While in design mode select one line of the macro code.
Press <ctrl><a> this will select all of the lines of your macro code.
Press <ctrl><c> this will copy all of your macro code to the clipboard.
In this thread:
Click on the [CODE/] button in the menu, you will see the two [CODE] [/CODE] tags.
Click/place the cusor between the tags and <ctrl><v> to past the macro code to the site. You will get something that looks like this: [CODE]<?xml version="1.0" encoding="UTF-16" standalone="no" ?><UserInterfac eMacros xmlns="http://schemas.microso ft.com/office/accessservices/2009/11/application"><U serInterfaceMac ro MinimumClientDe signVersion="14 .0.0000.0000">< Statements/><Sub Name="Sub1">
[z{remainder omitted}][/CODE]
You can step the code if you like; however, if you will just post the macro one of us may do this for you the first time so that you can see how it's done.
ThnxComment
-
-
This is all that it says:
Code:<?xml version="1.0" encoding="UTF-16" standalone="no"?> <UserInterfaceMacros xmlns="http://schemas.microsoft.com/office/accessservices/2009/11/application"> <UserInterfaceMacro For="OpenLastNameReport" Event="OnClick"> <Statements> <Action Name="OpenReport"> <Argument Name="ReportName"> INFOreport </Argument> </Action> </Statements> </UserInterfaceMacro> </UserInterfaceMacros>Comment
Comment