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

Date ( criteria limited ) Query ???

Status
Not open for further replies.
Oct 23, 2002
57
US
what i want to do is base a form and report on a query where in the query it returns all dates for the current year that have already passed by if another criteria field (check box is set to yes). And it the opposite direction do the same type of query but for dates in the same year that have not come to pass.

is something like this possible ??? [bigears]



 
For the first part, put this on the DateField criteria line
Between DateSerial(Year(Date()),1,1) and Date()
and on the Checkbox line put
Yes

For the second one, put the same thing on the DateField line and put
No
on the Checkbox line

Paul
 
There are probably a couple of ways to do this. One would be to use a date based query.

If Me.TglDateSelector Then
strSQl = "[Date] Between #" & Now() & _
"# AND #12/31" Year(Now()) "# "
Else
strSQl = "[Date] Between #" & Now() & _
"# AND #1/1" Year(Now()) "# "

That could be used to select a form or report with records (that have a field called 'Date') either before or after a date. (In this case today is included in both). If you just want a list of the dates, I guess you could make a table of every date, and select that based on this query.

Alternatively, I am sure there is some way you could use SQL to construct a table of the dates by saying that each record is +24hrs, and use addition of dates. I don't know right off-hand how to do this. You might try searching on adding dates.


-chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top