Im trying to create a customer details form that will take two user inputted dates (txtbookingstart and txtbookingend) and a room no. Then on the click event, edit the customerid field in the appropriate records in a different table "booking". Here is my code so far:
Private Sub Command22_Click()
Dim dbs As Database, rst As Recordset
Dim startdate As Date
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("Booking", dbOpenDynaset)
startdate = txtStartbooking.Text
Do Until startdate = txtEndBooking.Text
rst.FindFirst !Date = startdate And !roomno = txtRoomNo.Text
With rst
.Edit
!CustomerID = customerdetails.CustomerID
.Update
startdate = startdate + 1
End With
Loop
End Sub
It doesnt seem to like the fields in the booking table, i.e. !date. Also, Im not sure how to reference the customerid field, as it is the field that links the two tables.
Any Help MUCH APPRECIATED!!
Private Sub Command22_Click()
Dim dbs As Database, rst As Recordset
Dim startdate As Date
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("Booking", dbOpenDynaset)
startdate = txtStartbooking.Text
Do Until startdate = txtEndBooking.Text
rst.FindFirst !Date = startdate And !roomno = txtRoomNo.Text
With rst
.Edit
!CustomerID = customerdetails.CustomerID
.Update
startdate = startdate + 1
End With
Loop
End Sub
It doesnt seem to like the fields in the booking table, i.e. !date. Also, Im not sure how to reference the customerid field, as it is the field that links the two tables.
Any Help MUCH APPRECIATED!!