[AccessD] SQL statement problem

John Ruff papparuff at attbi.com
Thu May 8 12:34:31 CDT 2003


strSQLInsert = "insert into tblUserLog([ErrNumber], [ErrDescription],
[ErrDate], [UserName], [ShowUser], [CallingProc]) values " 

Error in this second line, the lngErrNumber is a number so remove the
apostrophe before and after lngErrNumber.  Now() is a date so place a #
before and after Now().  The SQL statement should be;
strSQLInsert = strSQLInsert & "(" & lngErrNumber & ",'" &
Left(strErrDescription, 255) & "',#" & Now() & "#', '" & fcnOSUserName & "',
'" & vShowUser & "', '" & strCallingProc & "')"



John V. Ruff - The Eternal Optimist :-)
Always Looking For Contract Opportunities

Home: 253.588.2139
Cell: 253.307/2947
9306 Farwest Dr SW
Lakewood, WA 98498

"Commit to the Lord whatever you do,
                and your plans will succeed." Proverbs 16:3



-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Nancy Lytle
Sent: Thursday, May 08, 2003 10:31 AM
To: Accessd
Subject: [AccessD] SQL statement problem


Can anyone see what is wrong with this statement?
I have a feeling it has to do with quote marks but I have been pulling my
hair out trying to get it,  I guess I just can't see the forrest for the
trees.

strSQLInsert = "insert into tblUserLog([ErrNumber], [ErrDescription],
[ErrDate], [UserName], [ShowUser], [CallingProc]) values " strSQLInsert =
strSQLInsert & "('" & lngErrNumber & "' ,'" & Left(strErrDescription, 255) &
"' ,'" & Now() & "', '" & fcnOSUserName & "', '" & vShowUser & "', '" &
strCallingProc & "')"

This is how it reads when I try and do the insert:
insert into tblUserLog([ErrNumber], [ErrDescription], [ErrDate], [UserName],
[ShowUser], [CallingProc]) values ('2102' ,'The form name 'This Form' is
misspelled or refers to a form that doesn't exist.' ,'5/8/2003 1:28:00 PM',
'nlytle', 'True', 'Form_Open()')

Thanks,
Nancy L

_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list