PDA

View Full Version : query criteria = Now()



wasim_sono
09-10-2007, 06:47 AM
Dear all

I have a table having a date field. Now I designed a form based on a query and that query has designed through above said table. I gave =Now() in date field criteria in query.
Now I required that as the form open it matches the date field contents with current or system date and show all records fulfil the criteria. but I got null record.
Any one have an idea? if yes then please help me to figure out that problem.

Thanks.

Wasim

OBP
09-10-2007, 12:24 PM
Wasim, I do not think that you need the "=" in the Criteria Row.
The other problem that you may be having is that Now() has the time as well as the date.
Try using the Date() function instead.

wasim_sono
09-12-2007, 12:46 AM
Dear OBP

I have tried Now() without '=' but didn't get eresult. Also Date function is not working. Would be you kindly explain the syntax of Date()?

Thanks.

Wasim

asingh
09-12-2007, 03:56 AM
Hi,

Are you sure..the date being compared to NOW() is actually a date..? Is it Date/Time data type in the table structures...also please paste the sql query..so we can see it..

asingh

wasim_sono
09-13-2007, 05:58 AM
Hi

yes the datatype of table field is date/time and fixed to as 'short date'.
the query is as under


SELECT Main_Mail.TicklerDate, Main_Mail.Tickler_Remarks, Main_Mail.Sub
FROM Main_Mail
WHERE (((Main_Mail.TicklerDate)=Now()));


Thanks for an early reply.

Wasim

Norie
09-13-2007, 09:17 AM
Wasim

You aren't using either Date or Now in that query.

You are asking for a parameter.

OdiN
09-13-2007, 11:47 AM
SELECT Main_Mail.TicklerDate, Main_Mail.Tickler_Remarks, Main_Mail.Sub
FROM Main_Mail
WHERE ((Main_Mail.TicklerDate)=Date());

wasim_sono
09-13-2007, 11:36 PM
Hi

The code is now corrected.

Thanks.

Wasim