Add a Value (1 Viewer)

mike60smart

Registered User.
Local time
Today, 17:05
Joined
Aug 6, 2017
Messages
1,904
Hi Everyone

I have a Combobox named "cboRoom" which allows me to select from a list of Room Types ie

Superior
Executibe
DeLux etc...

Is it possible that when a user selects a Room type it will automatically add 1 to a Control Named "Allocated"

I am trying to show a running Total of Rooms Allocated.

Any help appreciated
 

JHB

Have been here a while
Local time
Today, 18:05
Joined
Jun 17, 2012
Messages
7,732
Use the after update event for the combobox to add 1 to the control.
 

mike60smart

Registered User.
Local time
Today, 17:05
Joined
Aug 6, 2017
Messages
1,904
Hi JHB

What would be the syntax for that?
 

Minty

AWF VIP
Local time
Today, 17:05
Joined
Jul 26, 2013
Messages
10,368
You would normally calculate a allocated amount of things, by adding up the number of things that meet a criteria. That way if any of the things change the calculation would automatically reflect that.

If you store the qty, you would have to ensure any action anywhere in your database would subtract 1 from your allocated qty. This can get very difficult to manage.

So if you have rooms, you should probably have a table with room bookings. This would have a room id and a booking start and end date. You would then query to calculate what rooms where booked on a given date. If a booking is cancelled you would flag the room booking as cancelled and ignore it in your calculations.
 

Users who are viewing this thread

Top Bottom