Calling a function for end dates

rkrause

Registered User.
Local time
Today, 07:28
Joined
Sep 7, 2007
Messages
343
I have this funtion set up

Function GetAllDate(dt as Date) as Date
GetAllDate = DateAdd("s",-1,DateAdd("d",1,DateValue(dt)))
End Function


i want to call it in my criteria for end dates

Heres what I have in my query criteria:

Between #1/1/2008# And GetAllDate

when i go to run the query i get a data type mismatch

can anyone tell me how I could do this so it will work.

Thanks
 
First it looks like you need to pass it a date:

Between #1/1/2008# And GetAllDate(SomeDateNeedsToBeHere)
 
Between #1/1/2008# And GetAllDate(12/31/2008)

when I did this I got no records returned. when there should be around 3000
 
Between #1/1/2008# And GetAllDate(12/31/2008)

when I did this I got no records returned. when there should be around 3000

Should be

Between #1/1/2008# And GetAllDate(#12/31/2008#)
 
Also, this doesn't make sense:

GetAllDate = DateAdd("s",-1,DateAdd("d",1,DateValue(dt)))

Why using S which is SECONDS. That makes no sense. Also, The other part
DateAdd("d",1,DateValue(dt)

doesn't either.

What is it you are exactly looking for with this function?
 
Call this function for the end dates so that it will encompass all the times for the date after midnight. We don't call this for start dates though.
 
Call this function for the end dates so that it will encompass all the times for the date after midnight. We don't call this for start dates though.
So are you saying that your field has a Time element to it and you just want to make sure that the date is correct to include all times for that selected date?

So, this would do it for you without the function:

Between #1/1/2008# And #12/31/2008 11:59:59 PM#
 

Users who are viewing this thread

Back
Top Bottom