Date ranges and aloowing for Null

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am having problems with a form that asks for a date range and allows for
Null(pulling up all dates if not selected) My table is tblLineData, my form
is frmDateLine (it asks for what date range and/or what line number), my
query is qryDateLine. Thanks in advanced. also i may need code examples as im
am new to VB.
 
Andrew Allen said:
I am having problems with a form that asks for a date range and allows for
Null(pulling up all dates if not selected) My table is tblLineData, my
form
is frmDateLine (it asks for what date range and/or what line number), my
query is qryDateLine. Thanks in advanced. also i may need code examples as
im
am new to VB.


In your query, put the following as criteria on your date field:

Between NZ([Forms]![frmDateLine]![MyStartDate], #1700-01-01#) and
NZ([Forms]![frmDateLine]![MyEndDate], #9999-12-31#)
Modify the dates in the above to a range that won't possibly exclude any of
your records.

Your form must be open for the query to run.
 
OK i put that in but it pulls all dates, btw i have added a calender for the
user to put in these fields.

Joan Wild said:
Andrew Allen said:
I am having problems with a form that asks for a date range and allows for
Null(pulling up all dates if not selected) My table is tblLineData, my
form
is frmDateLine (it asks for what date range and/or what line number), my
query is qryDateLine. Thanks in advanced. also i may need code examples as
im
am new to VB.


In your query, put the following as criteria on your date field:

Between NZ([Forms]![frmDateLine]![MyStartDate], #1700-01-01#) and
NZ([Forms]![frmDateLine]![MyEndDate], #9999-12-31#)
Modify the dates in the above to a range that won't possibly exclude any of
your records.

Your form must be open for the query to run.
 
Andrew Allen said:
OK i put that in but it pulls all dates, btw i have added a calender for
the
user to put in these fields.

Isn't that what you wanted "(pulling up all dates if not selected)"?

Please clarify.
 
Back
Top