Populate Form with Toggle Buttons

Kruger_jjp

New member
Local time
Today, 09:56
Joined
Sep 23, 2011
Messages
7
Hi, I have a form with about 40 Toggle buttons on it. I want the form to populate from a table. This table stores the status from rooms.

My table name is [Room]
Fields [Room] and [Room_Status]

I want to call the button BtnBS1 (Room BS1) and if the status for that room is occupied the button when loaded will be RED, and if it is available it must be green.
I want the form to be an graphical overview of what rooms are occupied and what rooms are available. By clicking on a green room I want another form to open to allow me to fill it with data.
How do I point to the table when I load the form?

Please help.

Thanks
 
What do you want to call room 100?

What do you want to call room 1000?
 
Hi Uncle Gizmo,

If have different areas Rooms for eg. I have Blue Singles from 1 to 30 this is the reason for using BS1 to BS30, then I have Main Camp 1 to 30 and I call that rooms MC1 to MC30 and then I have Green Singles from 1 to 30 etc.
 
I assume that you want to place the buttons on the form to represent the layout of the rooms on site. It looks like you have three separate groupings for the rooms, around 30 rooms in each grouping the total being 3 times 30 = 90 rooms. It would make sense to treat the problem of updating the form for the whole set of rooms in one go, instead of each individual set of rooms updated individually. If that sounds sensible to you then we just need to write some code which cycles through the table of rooms, checking on the room condition and adjusting the display token accordingly.
 
I would also suggest you have a look at this example database as it has much of the functionality you desire. It uses "Text Boxes" as the indicators which is something I think you should consider.
 
Thanks for coming back. I will have a look at what you suggested.
:)
 
Thanks for coming back. I will have a look at what you suggested.
:)

I haven't studied the sample database in any details however it does look a bit intimidating especially if you are new to MS Access.

I would suggest that you create a new empty database and copy parts from the sample database with the goal of getting the functionality you require with the minimum of parts.

I would be happy to make suggestions if you require.

My guess is the sample database uses what would be termed as a data driven approach.

When the form is opened the date labels are provided with a caption reflecting the date that the particular label should display.

In your particular case you probably want this process to provide your labels with a "room name" and a colour defining the condition of the room.

Another technique you may need to employ is to handle all of the relevant controls on the form en bloc, that is as a collection. In other words you loop through the collection making changes where and when necessary.

I have done a post on this method on my website here:
http://msaccesshintsandtips.ning.com/profiles/blogs/948619:BlogPost:16538
which you may find of interest.
 

Users who are viewing this thread

Back
Top Bottom