Lock a field based on value entered in another field

Robyn Demeule

New member
Local time
Today, 11:25
Joined
Apr 25, 2007
Messages
1
Hi,
I have a combo box called Program from which two choices (EEHB and EHB) can selected. I also have two eligibility date fields, one DateEligible and the other DateEligibleOther. If ''EEHB' is selected, I want to lock the DateEligibileOther field to prevent data entry and vice versa (if EHB were selected I want to lock the DateEligible field).

Is it possible to do this?
 
Hi,
I have a combo box called Program from which two choices (EEHB and EHB) can selected. I also have two eligibility date fields, one DateEligible and the other DateEligibleOther. If ''EEHB' is selected, I want to lock the DateEligibileOther field to prevent data entry and vice versa (if EHB were selected I want to lock the DateEligible field).

Is it possible to do this?

Yes it is.

:)


Hint - each control should have a Locked property. So when your combo box changes, test its value, then lock and unlock the other controls as needed.
 
Put this in the afterupdate of your program combobox field

Code:
If (Me.Program="EEHB") Then 
DateEligibileOther.locked=True
elseif (me.program="EHB")
DateEligible.locked= True
end if
 
Put this in the afterupdate of your program combobox field

Code:
If (Me.Program="EEHB") Then 
DateEligibileOther.locked=True
elseif (me.program="EHB")
DateEligible.locked= True
end if

That's close, but it's not unlocking the other control that shouldn't be locked. So unless the form's On Current event specifically unlocked the controls, you may have unexpected results.
 
That's close, but it's not unlocking the other control that shouldn't be locked. So unless the form's On Current event specifically unlocked the controls, you may have unexpected results.
Code:
If (Me.Program="EEHB") Then 
DateEligibileOther.locked=True
DateEligible.locked= False
elseif (me.program="EHB")
DateEligible.locked= True
DateEligibileOther.locked=False
end if
there now they are unlocked
 

Users who are viewing this thread

Back
Top Bottom