Vba sql Date Time identifier

mardi 3 mars 2015

Hey Guys,



i am having an issue with sql in vba using a variable for a date time field.



i know you identify date variables with #

i know you identify text variables with '



But now i have a date time field that is set to date but when i run the sql it does not find a match. i have confirmed that both rec and ercd match.



Also, when i change the table to text, i am able to match with single quote but i would like to keep the table as date if i can.



Please help!!



Below is the sql statement in question



isql = "SELECT * FROM Table1 WHERE from = '" & nm & "' AND rec = #" & ercd & "# AND sub = '" & esub & "'"

Vba sql Date Time identifier

0 commentaires:

Enregistrer un commentaire

Labels