Results 1 to 2 of 2
2001-10-30, 18:31 #1
- Join Date
- Oct 2001
- New York
- Thanked 0 Times in 0 Posts
Enabling/Disabling fields in a Form (Access97)
I am currently working on a form, where: If the Type of client is an "Individual" (from a dropdown list), then I want the ClientCompanyName to be disabled and the Prefix, FirstName, LastName be enabled, if the Type of Client is any other choice from the dropdown list, then the ClientCompanyName should be enabled, and the Prefix, FirstName, LastName should be disabled.
I almost got it to work in the AfterUpdate with the following code:
Private Sub ClientTypeID_AfterUpdate()
If Me!ClientTypeID = 1 Then
Me!ClientCompanyFullName.Enabled = False
Me!ClientPrefix.Enabled = True
Me!ClientFirstName.Enabled = True
Me!ClientMiddleName.Enabled = True
Me!ClientLastName.Enabled = True
Me!ClientSuffix.Enabled = True
Me!ClientCompanyFullName.Enabled = True
Me!ClientPrefix.Enabled = False
Me!ClientFirstName.Enabled = False
Me!ClientMiddleName.Enabled = False
Me!ClientLastName.Enabled = False
Me!ClientSuffix.Enabled = False
However, when ever I go back into the form, all of the fields are enabled again.
Any help would be greatly appreciated.
2001-10-30, 20:18 #2
- Join Date
- Jun 2001
- Crystal Beach, FL, Florida, USA
- Thanked 36 Times in 35 Posts
Re: Enabling/Disabling fields in a Form (Access97)
You need the same code in your form's Current event. However, the best way to handle this is to create separate procedure (call it EnableDisableControls, or whatever) and put all the code into it. Then, just call this routine from both locations.