Enabling/Disabling Buttons to Moderate User Data Entry in Custom Form Switchboard (1 Viewer)

pitt_ph

Registered User.
Local time
Today, 11:27
Joined
Sep 7, 2012
Messages
37
Hey all,

I've been revising an Access 2007 database, which is a series of 15 small forms, so everything runs off of a custom form which I've designated as a switchboard. From the main switchboard, there are two sub-switchboards: one to add data, and one to edit data. (We don't want people to edit their data until they are done with adding data to their form.)

On each switchboard form, there are buttons that go to each of the individual forms. Each individual form has been normalized (to the best of my ability), and uses as a foreign key the "FormID", which means that there is potential for a query that can "join" all the results of the tables, if it is deemed necessary. (The primary key tends to be an autonumber field in each form's table that's hidden from the user, which keeps individual entries distinct.) Each form control's ControlSource are fields within its own table (for a hypothetical example, "frm1" joins to "tbl1").

Each individual data form has a button that allows it to go back to its switchboard. (I was trying to find out in a previous post if you could change the behavior of a button depending on the mode the form is in (either "add" or "edit"), so depending on if a new record is being entered into the database or not, the button could route back to the appropriate subform. I have not implemented this change yet.)

The trouble is, with all the sub-form buttons that we have, I'd like to make sure that once a user is done adding data into each form, the user cannot go back and "add" data into that particular form. I don't want to allow the user to click a button until it is that button's "turn" in being clicked.

I have experience with Enabling buttons and controls with VBA. but I can't wrap my head around slowly "enabling" buttons for the user to go through (thereby moderating workflow). Therefore, I'm eliciting suggestions from the Access folks on this forum.

Does anyone have suggestions on what to do for this matter? Thank you in advance!
 

llkhoutx

Registered User.
Local time
Today, 10:27
Joined
Feb 26, 2001
Messages
4,018
If you know about buttons and when they been clicked then uou should understand "events." When the appropriate event has occurred, disable other buttons as you think appropriate..
 

pitt_ph

Registered User.
Local time
Today, 11:27
Joined
Sep 7, 2012
Messages
37
Look, I understand that much. What I'm worried about is, if I try to exit the switchboard, go to another form and return to the switchboard, I'd like to have the button remain disabled. I'd also like the button to regain function as soon as a new record has been entered and someone goes through the switchboard to enter another new record.
 

llkhoutx

Registered User.
Local time
Today, 10:27
Joined
Feb 26, 2001
Messages
4,018
If a button is disabled when the form loses focus, it will be disabled when the form regain focus unless your form resets to enabled on regaining focus. If the form is closed and then is re-opened that is different.

Think of the events being fired - disable/enable the button as required on the appropriate event.
 

pitt_ph

Registered User.
Local time
Today, 11:27
Joined
Sep 7, 2012
Messages
37
If a button is disabled when the form loses focus, it will be disabled when the form regain focus unless your form resets to enabled on regaining focus. If the form is closed and then is re-opened that is different.

Think of the events being fired - disable/enable the button as required on the appropriate event.

Interesting thought -- I knew this would be easy if I kept all the forms upon upon their use. Unfortunately, the switchboard form is being closed and reopened whenever a button is pressed, because otherwise the user would end up with at least 15 tabs open, and that'd get terribly confusing for them.

What could be done in the case that the form closes and reopens? A part of me is contemplating setting all the buttons in the "add entry" switchboard to be disabled to start with, and only enable (through openargs...?) when the button going back to the switchboard is pressed.

Would this make sense, and if this is the case, how can I pass along the instructions from a data entry form to a switchboard, to enable the next data entry form button only when the button going back to the switchboard is pressed?
 

llkhoutx

Registered User.
Local time
Today, 10:27
Joined
Feb 26, 2001
Messages
4,018
You could bind the form to a table holding the status (enabled or disabled) of the check box which indicates whether or not the button is enabled. On the form Open event, check the value of that check box and enable or disable the button as appropriate. Each time the visability of the button changes change the value of the hidden check box. Bind the form to record 1 - see below.

Alternatively use DAO or ADO to check the button status in record 1 of a mere table. Use record 1, in the event records get inadvertently added to the table.
 

Users who are viewing this thread

Top Bottom