Pass Through Query

R

Rubie

Hello,

How do I get a pass through query to pull data from a column that has date
and time in it?

Thanks in advance for your help.
 
R

Rubie

I didn't mention that I want the query to pull data for the current date only.

Thanks.
 
S

Stefan Hoffmann

hi Rubie,
How do I get a pass through query to pull data from a column that has date
and time in it?
This really depends on your back end as you have to use its SQL dialect.

mfG
--> stefan <--
 
R

Rubie

Thank you for responding Stefan. When I was trying to run the query I tried
"Where DateAdded =Now()" but it didn't like that.
 
J

John Spencer

With MS SQL you would need to use
SELECT *
FROM SomeTable
WHERE DateAdded Between GetDate() and DateAdd('day',1, GetDate())

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
R

Rubie

Hi John,
I tried it and got this error message =>Invalid parameter 1 specified for
dateadd. What are your thoughts on that?
Thanks,
 
J

John Spencer

My error

It should be
DateAdd(day,1,GetDate())

I forget, but I think GetDate returns the current date AND time so you are
going to need to convert that to get just the date portion.

This expression should work, but I'm not sure it is the best expression to do
this.
Convert(DateTime,Convert(VarChar (10),GetDate(), 101))
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
Top