When I enter a date in a field named 'Payment Date' in a form derived from a table named 'Bookings', I want that same date to be added to all other records that share the same Invoice Number 'Inv No'.
I have tried the following code but it seems to glitch at the end of the 'SET' line.
Where have I gone wrong pse, and does anyone know a good link for learning VBA/SQL syntax?!
I have tried the following code but it seems to glitch at the end of the 'SET' line.
Code:
Private Sub Payment_Date_BeforeUpdate(Cancel As Integer)
Dim strSQL As String
Dim SelectedDate As Date
Dim SelectedInvoice As Long
SelectedDate = [Payment Date]
SelectedInvoice = [Inv No]
strSQL = "UPDATE [Bookings] " & _
"SET [Payment Date] = " & SelectedDate & _
"WHERE ([Inv No] = SelectedInvoice)"
Call CurrentDb.Execute(strSQL)
End Sub
Comment