Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query between startdate and enddate

Status
Not open for further replies.

peini

Programmer
May 1, 2002
13
US
I have created a QBF, which depends on what the search criteria users enter into the form. The form variables
will be feed into the query criteria dynamic.
The problem is I want the user be able to search based on the date, there're startdate and enddate on the search form,
and those are all optional fields. The startdate and enddate
will search on the same field in the table. I don't know
how can I feed those form value into the query criteria dymanic since they are optional.
IF I use the following criteria in the query

Between [Forms]![formname]![txtStartTime] And [Forms]![formname]![txtEndTime]

then they have to be required fields.
I've used IIF(not IsNULL(...... kind of complex expression,
but got all kind of errors. So if you have any codes similar
to this, and working, please show me.
I've been stuck with this part for a while, please help.
Thank you.
 
peini,

There may be a way to do this, I have created a form with the same criteria for a query/report.
What I did was to force a default value in the fields like startdate="date()-1" and enddate="date()".
This action can also be put into VB, but , unfortunately, I did not use VB for this project.

I hope this helps.

crpjaviman
 
Thanks for the infor.
I will see if there's any other to work around.
Any other suggestion?
 
Hi, crpjaviman

I end up using the same concept you suggested
and it's working now. Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top