Hello,
I have the following code and cannot get it to work i have been at it for hours and im getting the error 3134, Syntax Error in INSERT INTO Statement.
Any help would be great
I have the following code and cannot get it to work i have been at it for hours and im getting the error 3134, Syntax Error in INSERT INTO Statement.
Any help would be great
Code:
Private Sub Command20_Click()
Dim mySQL As String
Dim rs As dao.Recordset
Set rs = CurrentDb.OpenRecordset("Select [Admins].[Name_] From [Admins] Where [Pin_] = '" & Me![Text2] & "';", dbOpenSnapshot)
With rs
If .RecordCount <> 0 Then
mySQL = "INSERT INTO Access Histroy (Date_, Time_, Name_)"
mySQL = mySQL & "SELECT Date() AS Date_, Time() AS Time_, Name_ AS Name_"
mySQL = mySQL & "FROM Admins"
mySQL = mySQL & "Where [Pin_] = '" & Me![Text2] & "'"
DoCmd.SetWarnings False
DoCmd.RunSQL mySQL
DoCmd.SetWarnings True
Else
End If
End With
Set rs = Nothing
End Sub