Gray Out/Not required or Not Grayed Out/Required depending on value in listbox (1 Viewer)

joe789

Registered User.
Local time
Today, 11:35
Joined
Mar 22, 2001
Messages
154
Hi Folks,

I have a form that has a listbox as one of its items. The listbox has 4 values and is a required field. If the very first value of the listbox is selected, I would like to somehow make 2 other fields on the form non-mandatory and grey them out because there would not be enough information for the user to populate them. However, if any value other than the first value in the listbox is selected, I would like those same 2 fields not greyed out and mandatory/required to save/advance to the next record. Is there any easy way that I can do this? Any help would be greatly appreciated ... this database is for government/non-profit.

Also, one other question ... this would be nice, but the first question is the most important ... I have three date fields on the form. I am trying to make a validation rule for the date fields so that I can reject values that are less than the preceeding date fields (i.e. ... Time of Call must proceed Page to oncall staff and that must proceed response time). However, when I try to write up a validation rule in the table ... it says that the validation rule cannot span fields. So I think some code would be needed. Any help would be greatly appreciated.

Thank you very much,

Joe
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 06:35
Joined
Feb 19, 2002
Messages
43,213
In the Current event of the form, you need something like:

Code:
If cbo1 = somevalue Then
    fld2.enabled = False
    fld3.enabled = False
Else
    fld2.enabled = True
    fld3.enabled = True
End If

You also need to call this code from the AfterUpdate event of cbo1.
 

Users who are viewing this thread

Top Bottom