Hi,
I've written a short module to update a field in my table:
Function TestUpdateQuery()
Dim strSQL As String
strSQL = ""
DoCmd.SetWarnings False
strSQL = "UPDATE tblLocal set [LoadBoxNo] =2" & " WHERE [LoadBoxNo] =100 And [TruckNo] = " & Forms!frmDriverEdit2.Form!txtTruckNo & ";"
CurrentDb.Execute (strSQL), dbSeeChanges + dbFailOnError
End Function
I need to filter by delivery date also, therefore i've added Delivery Date to the SQL statement:
strSQL = "UPDATE tblLocal set [LoadBoxNo] =2" & " WHERE [DeliveryDate] = " & Format(Forms!frmLoadAllocation.Form!cboAllocationDate.Column(0), "mm/dd/yyyy") And [LoadBoxNo] =100 And [TruckNo] = " & Forms!frmDriverEdit2.Form!txtTruckNo & ";"
but i'm getting a compile error. I can't seem to see where i'm going wrong. Can anyone help!
Thank you.
I've written a short module to update a field in my table:
Function TestUpdateQuery()
Dim strSQL As String
strSQL = ""
DoCmd.SetWarnings False
strSQL = "UPDATE tblLocal set [LoadBoxNo] =2" & " WHERE [LoadBoxNo] =100 And [TruckNo] = " & Forms!frmDriverEdit2.Form!txtTruckNo & ";"
CurrentDb.Execute (strSQL), dbSeeChanges + dbFailOnError
End Function
I need to filter by delivery date also, therefore i've added Delivery Date to the SQL statement:
strSQL = "UPDATE tblLocal set [LoadBoxNo] =2" & " WHERE [DeliveryDate] = " & Format(Forms!frmLoadAllocation.Form!cboAllocationDate.Column(0), "mm/dd/yyyy") And [LoadBoxNo] =100 And [TruckNo] = " & Forms!frmDriverEdit2.Form!txtTruckNo & ";"
but i'm getting a compile error. I can't seem to see where i'm going wrong. Can anyone help!
Thank you.