I have a form that gives the total amount of Cabins that can be booked, broken out into 3 catergories: OV, Inside, and Balcony. The number of each available cabin is entered at the beginning, and as people book cabins (which is done via a combobox on a different form based off of a different table) i need the available number of cabins to reflect those already booked.
Ex: we're given 3 OV cabins, 3 Inside Cabins, and 3 Balcony cabins to start. Someone books an OV cabin - i need the number of OV to go to 2.
I used a simple IF THEN on the AfterUpdate of the CabinCategory Field like this:
- Private Sub Balcony_Category_AfterUpdate()
-
If Forms![frmPaxInfo]![Category] = "OV" Then
-
Forms![frmCabins]![OVAmt] = Forms![frmCabins]![OVAmt] - 1
-
End If
-
If Forms![frmPaxInfo]![Category] = "Inside" Then
-
Forms![frmCabins]![InsideAmt] = Forms![frmCabins]![InsideAmt] - 1
-
End If
-
If Forms![frmPaxInfo]![Category] = "Balcony" Then
-
Forms![frmCabins]![BalconyAmt] = Forms![frmCabins]![BalconyAmt] - 1
-
End If
-
End Sub
This works as long as someone doesnt change the category of a cabin, as it will just keep subtracting, and not add back on to the one that was originally there. I know i need to use a query(s) to add up the different types of cabins and then subtract that value from the starting total of each in order to keep the values acurate, but i have no clue how to do this.