I have the following SQL statements, when testing them they do bring back the correct information however they are not updatng the fields wihtin the tabl. The command button updating the table si based on the information being viewed fomr a listbox. i have also locked the listbox, so the individual does not need to select a particular order from there.
Code:
If MsgBox("Click Yes if this is a Onsite Delivery, Else click on No for Customer Collection", vbYesNo + vbQuestion) = vbYes Then
Me.Person.SetFocus
Sql = "UPDATE [tbl_Delupdate] SET "
Sql = Sql & "[CustomerCollection/OnsiteDelivery] = 'OD' "
Sql = Sql & "WHERE [Time of Transaction] = #" & datMaxDate & "# "
Sql = Sql & "AND [Cylinder Barcode Label] = '" & stringy1 & "' "
Sql = Sql & "AND [Works Order Number] = '" & Me.Person.Text & "' "
db.Execute (Sql)
MsgBox Sql
Debug.Print Sql
Else
Me.Person.SetFocus
Sql = "UPDATE [tbl_Delupdate] SET "
Sql = Sql & "[CustomerCollection/OnsiteDelivery] = 'CC' "
Sql = Sql & "WHERE [Time of Transaction] = #" & datMaxDate & "# "
Sql = Sql & "AND [Cylinder Barcode Label] = '" & stringy1 & "' "
Sql = Sql & "AND [Works Order Number] = '" & Me.Person.Text & "' "
db.Execute (Sql)
Debug.Print Sql
MsgBox Sql
End If
If StrPtr(stringy1) <> 0 Then
Me.Person.SetFocus
Sql = "Update [tbl_Delupdate] SET "
Sql = Sql & "[Date of D Status] = '" & Stringy2 & "', "
Sql = Sql & "[D Status] = 'Delivered' "
Sql = Sql & "WHERE [Time of Transaction] = #" & datMaxDate & "# "
Sql = Sql & "AND [Cylinder Barcode Label] = '" & stringy1 & "' "
Sql = Sql & "AND [Works Order Number] = '" & Me.Person.Text & "' "
MsgBox Sql
Debug.Print Sql
db.Execute (Sql)
MsgBox "Selected items have been marked as delivered for date " & Stringy2, vbInformation, "Items Delivered Successfully"
Else
Exit Sub
End If
End If