Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 3134 INSERT INTO Problem...

Status
Not open for further replies.

Elysynn

Technical User
Mar 18, 2004
82
US
Greetings,

I'm feeling particularly dense this morning - was hoping an extra set of eyes could tell me what I'm overlooking here...

I have the following bit of code to insert user information into a logging table. I'm getting the Error 3134 message when I open the form. The only field in the table not being referenced is ID - which is an autonumber field.

Code:
Private Sub Form_Open(Cancel As Integer)

Dim strLogStatus As String
Dim datLogDate As Date

gblUser = Environ("UserName")
strLogStatus = "In"
datLogDate = Now()

DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO tblUserLog(User, LogStatus, LogTime)" & _
             " VALUES '" & gblUser & "', '" & strLogStatus & "', #" & datLogDate & "#;"
              
DoCmd.SetWarnings True

End Sub

Thanks for taking a peek... I'm so glad it's Friday

TIA,
Elysynn
 
Elysynn,
Wrap the VALUES statement in parenthesis?
Code:
DoCmd.RunSQL "INSERT INTO tblUserLog(User, LogStatus, LogTime)" & _
             " VALUES [b]([/b]'" & gblUser & "', '" & strLogStatus & "', #" & datLogDate & "#[b])[/b];"

Hope this helps,
CMP

(GMT-07:00) Mountain Time (US & Canada)
 
Now how easy was that? :) Thank you so much, CMP!

-Elysynn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top