Enabling additional fields based on selection

Himy

New member
Local time
Today, 03:37
Joined
Jan 11, 2002
Messages
6
I have a data entry form, with 30 odd fields in it. One of the fields has a combo box with three available selections. Depending on the Selection in this combo box - I want to "Enable" two other combo boxes for addition information. These are set to disabled as default...
All information is to be stored in the one table.

How do I do it?

Thanks for oyur help,
Himy
 
Here's some code I used for this same purpose. It's based off a query connecting two tables, but the theory is the same:

Code:
Private Sub Form_Current()
Dim blnVisEnabled As Boolean
    
    If Me.DeviceName = "Car Club" Then
        blnVisEnabled = True
    Else
        blnVisEnabled = False
    End If

    Me.LicPlate.Enabled = blnVisEnabled
    Me.VehYear.Enabled = blnVisEnabled
    Me.VehModel.Enabled = blnVisEnabled

End Sub

HTH,
David R
 
Hi David thanks for that, although it doesn't work still!! here's what I have, if I can explain in a little more detail...

The error message I'm getting is this:

access1.jpg


The code I am assigning is this - it seems to check out no probs and is almost identical to 3 or 4 other codes people have shown me:

access2.jpg


The form and code assignment looks like this, comboboxes I've labelled in red...

access3.gif


Hope someone can help me!!!!

Cheers,

Himy
 
OK I fixed it, and just for anyone else who has the same problem, it worked when I changed the BeforeUpdate event procedure name to

=[Form_Current] instead of =Form_Current()

Cheers,

Himy
 
Errr...huh? Form_Current is an event, not a field. I'm not sure why that worked, and doubly-unsure why you're calling it from BeforeUpdate. If you don't understand the order in which events fire, you could lock yourself into some nasty loops.

The code I posted above is linked to [Event Procedure] in the Properties> Event>On Current event of my subform. It has to be called Private Sub Form_Current() (to my knowledge) in order for Access to know to set it off. I don't have anything in the BeforeUpdate event, and it makes them active/inactive immediately upon changing the value.

HTH,
David R
 

Users who are viewing this thread

Back
Top Bottom