We need to know what your data type is rather than the format that displays. Also, your subject line suggest "pass through query". Is that relevant to your question? Where is the data actually stored?
Are you wanting to display the results in a form or report text box?
Duane
MS Access MVP
Find out how to get great answers faq219-2884.
The thing is this...I want to use the end result of this query to build my form.
I want to change my date format so that I can use =Date() in the criteria row.
Since most computer uses this format mm/dd/yyyy. I don't think I can
compare Date() to yyyy/mm/dd.
Well, I use pass through query to get the data from SQL Server. Then I use the
pass through query to convert it into different date format.
And how it is stored in the SQL Server is varchar.
Any suggestion is greatly appreciated.
You can use sql in the pass-through like [blue]
WHERE Convert(VarChar(8),GetDate(),112) = YourDateField
[/blue]
I'm not sure where the "1200" comes from since you first state the data was like [red]'200403261200'[/red] and later suggested it was [red]yyyy/mm/dd[/red].
If you want a real/useable date returned by the pass-through, you can create a column [blue]
Convert(datetime,YourDateField)
[/blue]
Duane
MS Access MVP
Find out how to get great answers faq219-2884.
I tested my response in Query Analyzer.
Try a p-t query of:
SELECT USER_ID, DATE_TIME, TRUCK_NUMBER FROM TABLE_SON WHERE Convert(VarChar(8),GetDate(),112) = DATE_TIME
Duane
MS Access MVP
Find out how to get great answers faq219-2884.
H1004,
How is the date field actually storing the date value on the SQL Server? You have given two different answers to this in the past and haven't responded to me when I questioned this previously.
Duane
MS Access MVP
Find out how to get great answers faq219-2884.
The date field stored in the SQL Server is varchar 12 (example: 200403290000). So in my code
earlier, I have change them to DATETIME datatype, so it will be like (03292004).
That way, I can set my criteria to grab only today's date since the system date is in
datetime format.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.