Lock a field based on value entered in another field (1 Viewer)

Robyn Demeule

New member
Local time
Today, 15:48
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?
 

BrettStah

Registered User.
Local time
Today, 14:48
Joined
Apr 15, 2007
Messages
49
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.
 

rainman89

I cant find the any key..
Local time
Today, 15:48
Joined
Feb 12, 2007
Messages
3,015
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
 

BrettStah

Registered User.
Local time
Today, 14:48
Joined
Apr 15, 2007
Messages
49
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.
 

rainman89

I cant find the any key..
Local time
Today, 15:48
Joined
Feb 12, 2007
Messages
3,015
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

Top Bottom