change now() to date in a query

mkelly

Registered User.
Local time
Today, 14:42
Joined
Apr 10, 2002
Messages
213
I have a table with a "NOW()" field I need to change the now() to a Date() in a query so I can pull information by date values. Because of the time in the now() field it pulls incorrectly.

I have tried this:
cdate(int([job log in]![time qc totally complete]))
this will give me what appears to be a date field however when I use this criteria:
>=[forms]![Report Date Range]![BeginDate] And <=[forms]![Report Date Range]![EndDate]
I get the pop ups to enter my dates but then I get an error message.

Is the int turning it into a number?

how can I make it a straight Date() field in the query.

any help appriciated. I have been tryting to do this for two days!!
 
Still tinkering with this? Sorry :)

Or

Code:
Where DateValue(yourdate) Between #[forms]![Report Date Range]![BeginDate]# And #[forms]![Report Date Range]![EndDate]#

Ken
 
thanks but I have one more stupid question.

What do I put in
(your date) ??
 
mkelly said:
thanks but I have one more stupid question.

What do I put in
(your date) ??

The name of the date fld you want to work with.
 
Pat Hartman said:
The only time you need to enclose a date in delimiters is if you are building a string:

strSQL = strSQL & " Where SomeDate Between #" & Me.FromDate & "# AND #" & Me.ThroughDate & "#;"

When used directly in SQL, no delimiters are necessary.

QBE puts them in - Wonder why?

Code:
SELECT Table1.recno, Table1.datetime, Table1.textstuff
FROM Table1 WHERE (((Table1.datetime) Between #1/1/2004# And #1/1/2005#));
 
Hum... I see, guess I was a bit ahead of myself. Sorry for confusing the issue mkelly :)

So either of the following should work:

Code:
SELECT Table1.recno, DateValue([datetime]) AS Expr1, Table1.textstuff
FROM Table1
WHERE (((DateValue([datetime])) Between [Start] And [End]));

Would prompt the user for the dates...

And:

Code:
SELECT Table1.recno, DateValue([datetime]) AS Expr1, Table1.textstuff
FROM Table1
WHERE (((DateValue([datetime])) Between [Forms]![Form1]![startdate] And [Forms]![Form1]![enddate]));
Would ref text boxes...

Guess I should shut up and watch...
 
thanks for all the help but now that I am totally confused.

If this is my SQL query:
SELECT [Attorney Profiles].[Client Name], [Job Log in].[Client Number], [Job Log in].[Matter Number], [Job Log in].[Completed on Time], [Work Type].[Work Type], [Job Log in].[Number of Pages], [Job Log in].[time qc totally complete]
FROM [Work Type] INNER JOIN ([Attorney Profiles] INNER JOIN [Job Log in] ON [Attorney Profiles].ID = [Job Log in].[Client ID#]) ON [Work Type].ID = [Job Log in].[Work Type]
GROUP BY [Attorney Profiles].[Client Name], [Job Log in].[Client Number], [Job Log in].[Matter Number], [Job Log in].[Completed on Time], [Work Type].[Work Type], [Job Log in].[Number of Pages], [Job Log in].[time qc totally complete];


where would I put the sring to pull the date values from :[Job Log in].[time qc totally complete];
??
 
Basially, anywhere you would use

Code:
[Job Log in].[time qc totally complete]

Just use

Code:
DateValue([Job Log in].[time qc totally complete])

I think this would work...
 

Users who are viewing this thread

Back
Top Bottom