H hotplate Jul 31, 2006 #1 How do I take the value from a drop down list and use it for the criteria for a report of a query when I press a command button?
How do I take the value from a drop down list and use it for the criteria for a report of a query when I press a command button?
J Jeff Boyce Jul 31, 2006 #2 One way I've done this is to create a table that holds the Access report name, and a user-friendly report name that corresponds. I use a query of that table to fill the combo box, hiding the first column (Access report name) and showing the second. When the user picks a report, the command button runs code something like: DoCmd.OpenReport Me.cboMyComboBox with the report name that is in the first (bound) column of the combo box. -- Regards Jeff Boyce Microsoft Office/Access MVP Microsoft IT Academy Program Mentor http://microsoftitacademy.com/ Microsoft Registered Partner https://partner.microsoft.com/
One way I've done this is to create a table that holds the Access report name, and a user-friendly report name that corresponds. I use a query of that table to fill the combo box, hiding the first column (Access report name) and showing the second. When the user picks a report, the command button runs code something like: DoCmd.OpenReport Me.cboMyComboBox with the report name that is in the first (bound) column of the combo box. -- Regards Jeff Boyce Microsoft Office/Access MVP Microsoft IT Academy Program Mentor http://microsoftitacademy.com/ Microsoft Registered Partner https://partner.microsoft.com/
H hotplate Jul 31, 2006 #3 I guess I asked the question wrong. I am just trying to use the value from a drop down list to use it for a query criteria.
I guess I asked the question wrong. I am just trying to use the value from a drop down list to use it for a query criteria.
C chriske911 Jul 31, 2006 #4 hotplate wrote on 31/07/2006 : How do I take the value from a drop down list and use it for the criteria for a report of a query when I press a command button? Click to expand... what is your vba code to call the query? grtz
hotplate wrote on 31/07/2006 : How do I take the value from a drop down list and use it for the criteria for a report of a query when I press a command button? Click to expand... what is your vba code to call the query? grtz
H hotplate Jul 31, 2006 #5 I am going to have to read some more of the book Access for dummies. Thanks for the help
J Jeff Boyce Aug 1, 2006 #6 In your query, in the criterion row under the field, put a reference to the form & combobox. It will look something like: Forms!YourFormName!YourComboBoxName (substitute your form's name and your combo box's name). Note that this requires that the bound value/column in the combo box is what you need for the parameter/criterion. Note2: you can use the wizard in the query design mode to help you select the form and combo box. -- Regards Jeff Boyce Microsoft Office/Access MVP Microsoft IT Academy Program Mentor http://microsoftitacademy.com/ Microsoft Registered Partner https://partner.microsoft.com/
In your query, in the criterion row under the field, put a reference to the form & combobox. It will look something like: Forms!YourFormName!YourComboBoxName (substitute your form's name and your combo box's name). Note that this requires that the bound value/column in the combo box is what you need for the parameter/criterion. Note2: you can use the wizard in the query design mode to help you select the form and combo box. -- Regards Jeff Boyce Microsoft Office/Access MVP Microsoft IT Academy Program Mentor http://microsoftitacademy.com/ Microsoft Registered Partner https://partner.microsoft.com/