|
-
Jan 7th, 2006, 11:23 AM
#1
Thread Starter
Lively Member
Query Error
Dear Friends,
I am making a program,which requires the connection string query to return the dates... to the recordset
VB Code:
rst.open "Select * from table1 where dates>= " & dateadd("d",-val(combo1.text),now),conn,
Here dates is of DateTime Data type in MS Access which stores dates in table1.
combo1.text is numerical....
Actually i want to get the data for all the dates in the table,before combo1.text days from now...
HELP ME,
Thanks
"What we are is not decided by our qualities,
What we are is decided by our decisions"
-Albus Dumbledore
harry potter and the chamber of secrets
-
Jan 7th, 2006, 11:45 AM
#2
Re: Query Error
Dates for MS Access need to be delimited by the # sign.
When converting dates to a string for this purpose, the date should be formatted to mm/dd/yyyy otherwise there will be problems on systems
which use other date formats.
VB Code:
rst.open "Select * from table1 where dates>= #" & Format$(dateadd("d",-val(combo1.text),now), "mm/dd/yyyy") & "#",conn,
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|