Trying to select two dates and a text field on a form to run a query and open report

David Ball

Registered User.
Local time
Tomorrow, 09:19
Joined
Aug 9, 2010
Messages
230
Hi,

I have a form where I can select a Start Date into a text box, a Finish Date in another text box and select a Project from a listbox.
In the query criteria row for the date I have:
Between [Forms]![frmDateRangeANDProjects]![txtStart1] And [Forms]![frmDateRangeANDProjects]![txtEnd1]
In the criteria row for the project I have:
[Forms]![frmDateRangeANDProjects]![lsbProjSelwithDates]
When I try to run the report, by clicking a control button, the report opens but is empty.
If I open the query directly and manually type the dates and project into the dialogue boxes that open the query contains the correct results.
I have checked and double checked that I have the names of the text boxes and listbox correct and all looks OK.
What am I doing wrong?

Thanks very much
Dave
 
Query objects don't seem to like listbox.
Set a textbox on form with expression: = [lsbProjSelwithDates].Column(0)
Then query can reference the textbox, can set not visible.
Or use a combobox.
Or use VBA http://allenbrowne.com/ser-62.html
 
Thanks very much, June7
 
Just tried this and it works perfectly.

Is there a way to make it work if I select more than one Project from the listbox, or does that require VBA?

Thanks
 

Users who are viewing this thread

Back
Top Bottom