Updating "date" field in ACCESS from a vb form

carlos

New member
Joined
Feb 4, 2005
Messages
2
Programming Experience
Beginner
I'm not sure if I'm missing something here.
I'm tring to update the "Date" field in a record in an ACCESS database, using a form I designed in vb.net.
Everything else works fine but as soon as I try to send the date to the access form, I get an error saying there is a Syntax error in UPDATE statement.

As soon as I remove the part of the commandtext with date in it, it works absolutely fine. I have tried sending the date to ACCESS as a string rather than a date, but still no joy.

Here is the code I used:
VB.NET:
objCmd.CommandText = "UPDATE tblPNS SET Off = '" & _
strOff & "', Spa = '" & m_Spa & "', Hre = '" & _
m_Hre & "', Date = '" & m_Date & _
"' WHERE Off = '" & strOff & "'"

The first field is a string, the next two are integers, the last is a date.

I looked through the books and the forum first but couldn't find what I was doing wrong here. Can anyone point me in the right direction?
 
Thanks for the suggest. I managed to solve this last night - my stupidity: The column in the ACCESS database was named"Date" but it seems that "Date" is verboten even within the protected confines of a command query.
I changed the column name to "InvDate" and lo and behold it all worked out fine.
I will try the pound signs instead of single quotes too.
 
Back
Top