Query and Dates

ria4life

Registered User.
Local time
Today, 08:58
Joined
Feb 24, 2016
Messages
40
Im using this code below in query builder....Works fine....But i want it to return all results if i do not select and to and from dates.

Please assist.

between Forms![StudentForm]![txtBeginDate] and Forms![StudentForm]![txtEndDate]
 
perhaps something like

WHERE myDateField between nz(Forms![StudentForm]![txtBeginDate] ,myDatefield) and nz(Forms![StudentForm]![txtEndDate],myDatefield)
 
Having used this a lot, my work around is a little different.

Just change the form fields so that they have default values of:

DateAdd("m",-6,Date()) and Date()

This will automatically load the last six months and you can then change it to whatever you like.
 

Users who are viewing this thread

Back
Top Bottom