Hello everyone,
I am stuck on an update query within VBA. I debug.print window and it shows all the data correctly, but not updating to the table. The table name is travelcalendar and the fields I would like to update are:
updated (short text)
newclosingcall (date/time)
newfinalreport (date/time)
newdocfiling (date/time)
newchangedby (short text)
newentered (date/time)
WHERE is auditid (short name)
Here is what I have:
Any help or suggestions would be greatly appreciated. Thanks!!
I am stuck on an update query within VBA. I debug.print window and it shows all the data correctly, but not updating to the table. The table name is travelcalendar and the fields I would like to update are:
updated (short text)
newclosingcall (date/time)
newfinalreport (date/time)
newdocfiling (date/time)
newchangedby (short text)
newentered (date/time)
WHERE is auditid (short name)
Here is what I have:
Code:
strSQL = ""
strSQL = strSQL & "UPDATE travelcalendar " & vbCrLf
strSQL = strSQL & "SET [travelcalendar].[updated] = '" & Me.txtyes & "', [travelcalendar].[newclosingcall] = #" & Me.txtnewclosing & "#, [travelcalendar].[newfinalreport] = #" & Me.txtnewfinal & "#, [travelcalendar].[newdocfiling] = #" & Me.txtnewdoc & "#, " & vbCrLf
strSQL = strSQL & " [travelcalendar].[newchangedby] = '" & Me.txtuser & "', [travelcalendar].[newentered] = #" & Me.txtcreateddate & "#, " & vbCrLf
strSQL = strSQL & "WHERE [travelcalendar].[auditid] = '" & Me.txtauditidf & "' "
On Error Resume Next
CurrentDb.Execute strSQL
If Err.Number <> 0 Then
Debug.Print strSQL
MsgBox strSQL
Exit Sub
End If
Last edited: