Stang70Fastback
Registered User.
- Local time
- Today, 17:58
- Joined
- Dec 24, 2012
- Messages
- 132
Hey guys. I recently converted my back end to SQL, and since then I've been trying to track down things that broke, and fix them. I posted this in the SQL subforum, but I think it's actually a VBA issue, so I'm putting it here too (this subforum is also much more active.)
I'm having trouble getting timestamps to communicate properly between Access and SQL. I have a field set to a 'datetime' data type in SQL, but no matter how I structure the timestamp on the Access side, it does not seem to like the data.
The code below worked fine when the table was in Access:
But now that the table in in SQL and using an ODBC connection, I get a syntax error.
In SQL, I have the column for the timestamp set as a datetime field. Any help would be appreciated!
This might be related, but even on forms where I'm not using an INSERT INTO statement, my timestamps still act odd. One form has a textbox with a default value of "Now()" which worked fine when the back end was in Access. Now that the back end is in SQL, that textbox simply displays #error, and in the SQL database the value remains null.
I'm having trouble getting timestamps to communicate properly between Access and SQL. I have a field set to a 'datetime' data type in SQL, but no matter how I structure the timestamp on the Access side, it does not seem to like the data.
The code below worked fine when the table was in Access:
Code:
DoCmd.RunSQL "INSERT INTO ERRORLOG (ErrNum, ErrDesc, ErrProc, ErrUser, ErrTimestamp) " & _
"VALUES (" & TheNum & ", '" & TheDesc & "', '" & TheProc & "', '" & fOSUserName() & "', #" & Now() & "#);"
But now that the table in in SQL and using an ODBC connection, I get a syntax error.
In SQL, I have the column for the timestamp set as a datetime field. Any help would be appreciated!
This might be related, but even on forms where I'm not using an INSERT INTO statement, my timestamps still act odd. One form has a textbox with a default value of "Now()" which worked fine when the back end was in Access. Now that the back end is in SQL, that textbox simply displays #error, and in the SQL database the value remains null.