Disable other field in form

  • Thread starter Thread starter Kyle
  • Start date Start date
K

Kyle

The first box in my form, I have combo box for user to
select his/her name then fill in the remain of the fields.

How do I freeze all other fields in the form to prevent
user to enter until his/her name is selected first in the
Name field then the user can enter the remain of the fields.

Thanks.
 
There's probably a better way to do it but here's my ghetto (I dont know
access very much) version.

Have the user select his name on the previous for and click the button to
open the screen where he/she enters the information. Set the default value of
the UserName control to whatever it was on the other screen and lock it. That
way the users can't change details for other people by mistake.
 
Thanks anyway, I thought of that too but it is not what I
wanted.
The form is very simple, contains only 4 field belows the
name field. I don't want the user enter the other fields
first then go back and select the name from the list. I
want the other 4 fields locked by forcing the user to
select name first then unlock other 4 fields.
 
Well, if you know VB syntax (I dont) then you could loop through the controls
on your field and lock them to start and unlock them wehn OnDirty (or
whatever happens when you click a combo box).

Or else you could set Modal on your details field to YES meaning people
can't click on "parent" forms while it's open. That would fix you up fine.
 
Kyle,

Assuming the combo name is cboUser and the other four controls are named
ctrl1 through ctrl4 (and you change the control names to the actual ones),
use the combo's Before Update event to run the following code:

Dim cboStatus As Boolean
cboStatus = IsNull(Me.cboUser)
Me.ctrl1.Enabled = Not cboStatus
Me.ctrl2.Enabled = Not cboStatus
Me.ctrl3.Enabled = Not cboStatus
Me.ctrl4.Enabled = Not cboStatus

The Enabled property of the four controls should be set to No in the form
design, so they are not enabled when the form opens. Alternatively, you
could run the exact same code in the form's On Open event.

HTH,
Nikos
 
Back
Top