View Full Version : Enable=False


rhounsome
03-21-2002, 12:35 PM
Currently I have a form which displays customers called "Company". These customers can be of a different status. i.e. Gold or Silver. The status is obtained from a drop down list. This filed list is called "Customer Definition". If the user selects the status of Gold they enter a 3 Letter prefix which is obtained from a drop down list called "3 Letter Definition". However if the user selects Silver I want this option disabled.

I have tried writing an Event Procedure which is as follows

If Me.Company_Definition = "Silver" Then
cmd3_Letter_Definition.Enabled = False
Else
cmd3_Letter_Definition.Enabled = True
End If

If this Event Procedure is correct where do I put it. As I have tried putting it in the Before Update in the "3 Letter Definition" but it doesn't work.

Can anyone offer a solution?

Susilowati
03-21-2002, 06:27 PM
Hi There,

First, check if you got the variable name correctly.
You said you called the status as "Customer Definition". If so, then in your code you gotta have

If Me.Customer_Definition = "Silver" Then
cmd3_Letter_Definition.Enabled = False
Else
cmd3_Letter_Definition.Enabled = True
End If

Anyway, that is minor thing.
The other thing is where you have to put the event handler code. This code should be put at AfterUpdate event of Customer_Definition control.

Try that, let me know how you go.

cheers SS

Pat Hartman
03-22-2002, 10:54 AM
You also need to put the code in the Current event of the form. You can duplicate the code (not advised) or create a sub that runs from two places.