G
Guest
Hello all,
I am using Access 2002. I am not familiar with SQL, but managed to piece
together some SQL with the assistance of the HELP FILE. In my database, I
have a hidden form that I use to store variables to record modifications that
are made to records. I am trying to pull values from this temp form and
throw them into an existing table. It is reduntant, but I use it to record
the activities/changes people make.
The fields I am trying to to insert into an existing table called
Activity_Log are...
Forms!Temp.SR (text) to Activity_Log.SR (text)
Forms!Temp.Modify_BY (text) to Activity_Log.Modify_By (text)
Forms!Temp.str_Email_txt (text) to Activity_Log.Comments (text)
current date to Activity_Log.Modify_Date (Date/Time)
I am trying to execute this code when I close a form that is bound to
another table.
ERROR at runtime: Syntax error INSERT INTO Statement
DEBUGS fine. Any help would be appreciated.
Public Sub DoSQL()
MsgBox "DOSQL"
Dim SQL As String
SQL = "INSERT INTO tbl_Activity_Log ( SR, Comments, Modify_By,
Modify_Date ) " & _
"SET tbl_Activity_Log.SR = Forms![Temp].[SR], " & _
"tbl_Activity_Log.Comments = Forms![Temp].strEmail_txt, " & _
"tbl_Activity_Log.Modify_By = Forms![Temp].Modify_By, " & _
"tbl_Activity_Log.Modify_Date = Date() "
DoCmd.RunSQL SQL
End Sub
I am using Access 2002. I am not familiar with SQL, but managed to piece
together some SQL with the assistance of the HELP FILE. In my database, I
have a hidden form that I use to store variables to record modifications that
are made to records. I am trying to pull values from this temp form and
throw them into an existing table. It is reduntant, but I use it to record
the activities/changes people make.
The fields I am trying to to insert into an existing table called
Activity_Log are...
Forms!Temp.SR (text) to Activity_Log.SR (text)
Forms!Temp.Modify_BY (text) to Activity_Log.Modify_By (text)
Forms!Temp.str_Email_txt (text) to Activity_Log.Comments (text)
current date to Activity_Log.Modify_Date (Date/Time)
I am trying to execute this code when I close a form that is bound to
another table.
ERROR at runtime: Syntax error INSERT INTO Statement
DEBUGS fine. Any help would be appreciated.
Public Sub DoSQL()
MsgBox "DOSQL"
Dim SQL As String
SQL = "INSERT INTO tbl_Activity_Log ( SR, Comments, Modify_By,
Modify_Date ) " & _
"SET tbl_Activity_Log.SR = Forms![Temp].[SR], " & _
"tbl_Activity_Log.Comments = Forms![Temp].strEmail_txt, " & _
"tbl_Activity_Log.Modify_By = Forms![Temp].Modify_By, " & _
"tbl_Activity_Log.Modify_Date = Date() "
DoCmd.RunSQL SQL
End Sub