Pass Multiple Values to a Query

rgreene

Registered User.
Local time
Today, 12:26
Joined
Jan 22, 2002
Messages
168
My ultimate goal on this project is to take information from my database and export the information into a csv text file. Right now I'm working on phase 1 of my goal. I'm trying to run a query based on 3 fields of my form. On my form I have a Start Date text box (txtSDate) an End Date Text Box (txtEDate) and a combo box that lists all the workers (cboCWorkers). The users will enter in the start date (11/01/07) and the End Date (11/30/07) and choose a worker on my form (frmExport). When they click the button I want the query to run based on that criteria. So search all records for that worker between those dates. In criteria on my query (qryExport) under the CDate field I have [Forms]![frmExport]![txtSdate] and that returns all the data for all the workers with the Start Date of 11/01/07 or whatever date is entered in the txtSDate field on my form. When I added the [Forms]![frmExport]![cboCWorker] to the criteria of the CWorker field in my query. My query returns nothing. Looking in the table and running the query manually (entering the Start, End and Worker information by hand) I get lots of data returned. What do I need to do in order to get the query to use the values in the worker field on my form AND search a date range not just a specific date.

Thanks in advance

Rick
 
I would ask what value you have bound to your combo box? Make sure that the bound value is the value that you would use when you manually run the query.
 
The bound combo box is to a table that stores the workers names (tblCWorkers)

Rick
 
I figured it out.

Didn't know you could use the between command in this situation. my code is

Between [Forms]![frmExport]![txtSdate] And [Forms]![frmExport]![txtEdate]

Thanks
 
Last edited:
Glad to hear you got it figured out.
 
Kindly explain the what you have figured out, so that others could learn from it. Thanks
 

Users who are viewing this thread

Back
Top Bottom