G
Guest
Hi:
I created a tblLog to tract the users which has "Username"(captured NetID)
and "Date"(=now).
I created a frmSwitchboard bounds to tblLog and add the "txtUsername" and
"txtDate". I got an error using the codes below "Syntax error in INSERT INTO
statement". I'm a beginner and don't know how to properly execute a query.
Thanks.
Private Sub Form_Close()
Dim stDocName As String
Dim strSQL As String
strSQL = "INSERT INTO tblLog (Username,Date) VALUES ('" & txtUserName &
"', '" & txtDate & "');"
stDocName = "Switchboard"
If Me.txtCountUserName.Value = 0 Then
DoCmd.OpenForm "frmUnauthorizedUser"
Else
CurrentDb.Execute strSQL
DoCmd.OpenForm stDocName
End If
End Sub
I created a tblLog to tract the users which has "Username"(captured NetID)
and "Date"(=now).
I created a frmSwitchboard bounds to tblLog and add the "txtUsername" and
"txtDate". I got an error using the codes below "Syntax error in INSERT INTO
statement". I'm a beginner and don't know how to properly execute a query.
Thanks.
Private Sub Form_Close()
Dim stDocName As String
Dim strSQL As String
strSQL = "INSERT INTO tblLog (Username,Date) VALUES ('" & txtUserName &
"', '" & txtDate & "');"
stDocName = "Switchboard"
If Me.txtCountUserName.Value = 0 Then
DoCmd.OpenForm "frmUnauthorizedUser"
Else
CurrentDb.Execute strSQL
DoCmd.OpenForm stDocName
End If
End Sub