Automation error

Brian Robertson

Registered User.
Local time
Today, 19:20
Joined
Feb 27, 2002
Messages
15
I'm getting the following error "The object doesn't contain the Automation object 'strLoggedOn'" when running the VB line "DoCmd.RunSQL "INSERT INTO Time_Log (Name) VALUES (strLoggedOn)"". Does anyone know what the problem is ?
 
If you want to reference a varible in a SQL definition, you need to break the string, then insert the variable, then continue the string. You must also define what sort of value is contained within the variable. In this case the single quotation marks define the variable's data type as String.

DoCmd.RunSQL "INSERT INTO Time_Log (Name) VALUES ('" & strLoggedOn & "');"

HTH
Chris
 
Chris - thanks, I couldn't see it !
 

Users who are viewing this thread

Back
Top Bottom