Opening a Form and locking all controls

odrap

Registered User.
Local time
Today, 16:29
Joined
Dec 16, 2008
Messages
156
I like to create a form for managing client data with the following behaviour:
When the form opens all controls are displayed, without any data in it and locked.
When clicking on a button to enter a new client, all controls must be unlocked, and after entering the new client and hitting the button "Save",
all controls must be locked again, the new record displayed and the appropriate navigation buttons activated.
The same behaviour must be realised when hitting the button to "edit" a record . If for some reason the editing a record or the entering a new record must be canceled, all controls must be locked again and the appropriate navigation buttons activated. .
Is that a possible goal and are these requirements realistic for such a form?.
 
Assuming you are comfortable with some basic VBA, yes.

You can easily disable a control using the following code:
Code:
txtTextBoxName.Enabled = false

Or true if you want it enabled instead.

All you have to do is enable / disable the appropriate controls at the appropriate time (enable when clicking the command button to start inputting a record, disabled when the cancel or save button is clicked, etc).
 
This is quite unusual functionality, and goes against the way Access tries to work.

I think if I needed to implement a form to work in that way, the easiest way would be to make it unbound. Then you can add buttons/subs to clear all fields, and to save/update the record, without worrying so much about the security of data in the tables.
 
This is quite unusual functionality, and goes against the way Access tries to work.

I think if I needed to implement a form to work in that way, the easiest way would be to make it unbound. Then you can add buttons/subs to clear all fields, and to save/update the record, without worrying so much about the security of data in the tables.

I'm not sure I agree.

I see it as a command button to toggle the .enabled properties on the bound controls on & off to prevent accidental changes to the data (I use a similar system in one of my databases).

Other than that I don't see anything which is outside of a normal bound form, maybe with a command button set to move to a new record (which would automatically clear all controls as they are bound to fields which are now empty) to allow data input too.
 
well, i can certainly see the point of locking controls, and then enabling them with an "EDIT" button - but with a bound form the "SAVE" button is superfluous, and even worse, may wrongly make users think that their edits won't be saved unless they click the save button.

It's the active "SAVE" button to be honest, that I feel is not appropriate for bound forms.
 
Could you not have save & cancel buttons using:

Code:
DoCmd.RunCommand acCmdSave
&
Code:
If Me.Dirty Then
    DoCmd.RunCommand acCmdUndo
End If

I admit that my main form which uses this is unbound, but it should be usable with bound forms too with very little VBA.
 

Users who are viewing this thread

Back
Top Bottom