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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query criteria for date range 1

Status
Not open for further replies.

Kyosa

Technical User
Jun 12, 2000
47
0
0
US
background:
i have a form driving a report query with 2 unbound text boxes to enter a From and To date range. on my form i also have abt 4 other unbound fields all driving the report. Not all the fields are required to be entered.


i am using the following as the criteria for my date in the Query:

Between [Forms]![Mail_Log_Rpt]![Date_From] And [Forms]![Mail_Log_Rpt]![Date_To]

all nice and fine...however i need a way such that If they leave the Date_From and Date_To blank on the form, it pulls back all dates.

i have tried several different things and can get either one or the other to work but not when i try to come up with a combined formula... any ideas????



Kyosa


"The key to flexibility is indecision!" :)


 
Try this:

Code:
Between NZ([Forms]![Mail_Log_Rpt]![Date_From],[[i][red]currentdatefield[/red][/i]])And NZ([Forms]![Mail_Log_Rpt]![Date_To], [[i][red]currentdatefield[/red][/i]])

The NZ function checks both of the form controls for Null and if found returns the DateField in your query that is being checked. (i.e. the field name just before the in this query "Between") What will happen is that it will be compared against itself. So, all will be selected.

post back if you have any questions.

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
worked like a charm!! thanks very much for your help.!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top