Confirming if fixed positions are occupied or not (1 Viewer)

Sam Summers

Registered User.
Local time
Today, 23:01
Joined
Sep 17, 2001
Messages
939
Hi guys,

Trying to work out the best way to achieve this?

I have a table 'Booking' with fields 'BookingID' PK and other detail fields but also a field named 'Position'.

I have a form with a map and on it i have up to 113 buttons (Btn1 - Btn113)

When the user clicks the button it inserts the corresponding number into the 'Position' field.

I have another form which is the viewsite form where i want to see all the occupied spots (which are the buttons) red and the free spots clear or green.

I could have a 113 check boxes or 113 if then else statements but that seems a bit inefficient.

Any ideas would be amazing!

Many thanks
Sam
 

Gasman

Enthusiastic Amateur
Local time
Today, 23:01
Joined
Sep 21, 2011
Messages
14,350
Loop through your controls, check for left(Control,3) = "Btn" and then test for the value associated with that button.
Set colour accordingly ?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 17:01
Joined
Feb 28, 2001
Messages
27,223
Do those spots change frequently? I.e. do they represent a booking that expires (and thus becomes unoccupied over time without further human intervention)? Or do you have to click again manually to release the spot?

I'm thinking about a "Spots" table of 113 entries - with information about the individual spots - which would enable you to create a child table in the "time-scheduled" bookings case. Your "current" booking state for mapping would be query with a LEFT JOIN rather than an INNER join, and you could bind the map to that query that shows the booked items and that has NZ() for the unbooked slots so that the map would show them as EMPTY.

You still might want that table anyway since if it is all manual, you would be able to bind the spots to the buttons. Then on the "Map" form you could impose conditional formatting to get the color effects.

I said that kind of awkwardly, but the idea is that in your Bookings table, you have your location data. JOIN that to a SPOTS table with an OUTER JOIN, not an INNER JOIN, and then you have a ready-made data source for EVERY spot.
 

Sam Summers

Registered User.
Local time
Today, 23:01
Joined
Sep 17, 2001
Messages
939
Thank you guys for that.

I will play about with both of your ideas and see what i come up with over the next week or two and then i'll post what i've done.
Many thanks again!
 

Users who are viewing this thread

Top Bottom