scriptscribe
MIS
I'm trying to write a SQL statement that when a certain criteria is met in the VBA script that it will write the current row of data to an already existing table in Access. The below statement works, but it only writes the top row of data. I need to determine what the current record is, and write the four fields of data to the table.
Public Sub WriteError()
Dim SQLStr As String
strSQL = "INSERT INTO [tblErrorLog2] (ErrName, ErrDT, ErrDesc, ErrValue) " & _
"VALUES ('" & CSRNAME & "', '" & CSRDT & "', '" & CSRDESC & "', '" & CSRVAL & "');"
DoCmd.SetWarnings False
DoCmd.RunSQL (strSQL)
DoCmd.SetWarnings True
End Sub
I tried "WHERE RowID = '"& Me!RowID & "'";", but that didn't work.
Thanks for your help. These forums have helped me a lot, even when just reading old threads.
Mike
Public Sub WriteError()
Dim SQLStr As String
strSQL = "INSERT INTO [tblErrorLog2] (ErrName, ErrDT, ErrDesc, ErrValue) " & _
"VALUES ('" & CSRNAME & "', '" & CSRDT & "', '" & CSRDESC & "', '" & CSRVAL & "');"
DoCmd.SetWarnings False
DoCmd.RunSQL (strSQL)
DoCmd.SetWarnings True
End Sub
I tried "WHERE RowID = '"& Me!RowID & "'";", but that didn't work.
Thanks for your help. These forums have helped me a lot, even when just reading old threads.
Mike