This is where it didn't compile:
DoCmd.RunSQL "UPDATE InspEvent " & _
"SET InspEvent.SpecsLoaded = lngRecordsAdded " & _
"WHERE InspEvent.EventId = [Forms]![frmInspEvent]![txtEventId];"
This is where it didn't compile:
DoCmd.RunSQL "UPDATE InspEvent " & _
"SET InspEvent.SpecsLoaded = lngRecordsAdded " & _
"WHERE InspEvent.EventId = [Forms]![frmInspEvent]![txtEventId];"
Looking at your original code you have lngRecordsAdded
defined in your code module.
One update would be:
DoCmd.RunSQL "UPDATE InspEvent " & _
"SET InspEvent.SpecsLoaded = " & lngRecordsAdded & _
" WHERE InspEvent.EventId = " & [Forms]![frmInspEvent]![txtEventId]
Edit:
Another way would be:
Dim qdf As DAO.QueryDef
Set qdf = CurrentDb.QueryDefs("", "PARAMETERS RecordsAdded LONG, Event_Identifier LONG; " & _
"UPDATE InspEvent SET SpecsLoaded=RecordsAdded " & _
"WHERE EventID = Event_Identifier")
With qdf
.Parameters("RecordsAdded") = lngRecordsAdded
.Parameters("Event_Identifier") = [Forms]![frmInspEvent]![txtEventId]
.Execute
End With
Edit 2:
Looking through your original code you also have code blocks like:
If IsNull(DLookup("Vendor", "PurchaseOrder", strFilter)) Then
strVendor = "None"
Else
strVendor = DLookup("Vendor", "PurchaseOrder", strFilter)
End If
This could be shortened to the single line:
strVendor = Nz(DLookup("Vendor", "PurchaseOrder", strFilter), "None")