Query Access database from multiple variables

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have 3 drop down menus and I need the code for a button to take the results
from all 3 drop down menus and search my Access database.

Example:
The 3 drop down menus are... YEAR, MONTH, DATE.
The user will could select... 2004, JULY, 4th.
In the database there would be a record representing July 4th, 2004 and that
record would return a data in a report.

Can anyone tell me the code for the button that will perform this search?
Thanks!
 
I have 3 drop down menus and I need the code for a button to take the results
from all 3 drop down menus and search my Access database.

Example:
The 3 drop down menus are... YEAR, MONTH, DATE.
The user will could select... 2004, JULY, 4th.
In the database there would be a record representing July 4th, 2004 and that
record would return a data in a report.

Can anyone tell me the code for the button that will perform this search?
Thanks!

If your table has a Date/Time field containing the date of the record,
use a criterion of

DateSerial([Forms]![yourform]![YEAR], [Forms]![yourform]![MONTH],
[Forms]![yourform]![DATE])

in a Query. Base your report on the Query, and put a command button on
the form to open the report.

The Month combo should have a numeric field, 1 to 12, as its bound
column.

Note that all three of your control names are reserved words, and
Access will very likely get confused. I'd suggest naming them cboYear,
cboMonth, cboDay instead (and correspondingly changing the criterion).

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
Back
Top