cannot get dates to work when sql server connected to access using odbc

4 views
Skip to first unread message

tedpottel

unread,
Feb 4, 2010, 6:51:06 PM2/4/10
to SQL Server
Hi,
I have a sql server 2005 express data base linked to access using
ODBC. I keep getting a error when I put the dates in as a string in
the sql code, here is the code
in access vb
Dim stDocName As String
Dim stLinkCriteria As String
mysql = "SELECT dbo_tInventory.date, dbo_tInventory.id from
dbo_tInventory WHERE dbo_tInventory.date<'20011111'"
CurrentDb.QueryDefs("qInventory").SQL = mysql
stDocName = "qInventory"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command0_Click:
Exit Sub

If I chnage
WHERE dbo_tInventory.date<'20011111'"
to WHERE dbo_tInventory.date<Now()
no error, this does not make sense becouse I thought Now is a access
database command not sql server.
Ted

Brett Stinson

unread,
Feb 9, 2010, 9:38:53 PM2/9/10
to sql-s...@googlegroups.com
Ted:
Try using dashes in your date.... '2001-11-11'.

Thanks,

Brett Stinson
brett....@gmail.com

--
You received this message because you are subscribed to the Google Groups
"SQL Server" group.
To post to this group, send email to sql-s...@googlegroups.com.
To unsubscribe from this group, send email to
sql-server+...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/sql-server?hl=en.

Reply all
Reply to author
Forward
0 new messages