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

how do i pass date to a query criteria ?

Status
Not open for further replies.

smayshar

Programmer
Aug 30, 2003
42
AU
I have a field in a form that the user can enter a date
I would like to pass this date to a criteria of a report
so I will see only these dates records
I have somthing similar that I use between[forms]![fName]![fieldName]and [forms]![fName]![fieldName]
when I'm trying to make a criteria of exact date I get empty resaults ???
 
If you are using between to attempt to get an exact date it will not work. This is because there can not be a date between a single date range.

If you wish to still use between when the start date and end date are equal you will have to subtract a day from the start date and add a date to the end date.


HTH,


Steve
 
thenk's steve for halping

no no I'm not trying to use between , first I tried to put
[forms]![fName]![fieldName] as a criteria it didnt work, then I tried to call a fanction from a general modules to return the value that the user enter but this didnt work aswell my problem is how do I get an exact date that the user will enter to a field in a form ??
 
There's the possibility that either the form control or the field contains a timestamp (holding both date and time - as in populating them with the Now() function in stead of Date()), then trying to match #2/5/2004 11:53 PM# with #2/5/2004# won't give any records.

Then perhaps try to use the format function on both the field and the criteria.

If you don't get it to work, perhaps tell where you're using this (query, where condition of an openreport...), post the relevant SQL/Code... AND there might also be challenges relating to regional settings, if you're using a non US date setting where you operate...

BTW - try the following as criteia on a numeric field containing the value 1: [tt]Between 1 and 1 [/tt];-)

Roy-Vidar
 
when I try between (date()-1)and (date()+1) it works fine for the computer date
So I asume the date types are the same
any idea what will be the exact way to write the criteria ?

thank you for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top