Disable a combo box based on certain values

J

Joy

Hi I am a novice at this.. but learning as I go.. I have created a form with
comboxes. I would like:-

If certain values in a combo1 picklist is selected then
combo 2 is disabled. I've tried coding it with:-

Select Case Me!ComboSpec2
Case "Deputy Director", "Director"
Me!ComboSpec3_1.Enabled = False
Case Else
Me!ComboSpec3_1.Enabled = True
End Select

So what is happening is if I pick Director or Deputy Director as a value in
ComboSpec2 (At 'AfterUpdate' Property) then ComboSpec3_1 should be disabled.
It does not seem to be the case. Its there - enabled :-(

Also I tried (also unsuccessful):

If ComboSpec2.Value = "Director" Then
Me!ComboSpec3_1.Enabled = False

Else
'do nothing

DoCmd.Requery "ComboSpec2"
DoCmd.GoToControl "ComboSpec3_1"

End If


Pls help! Thanks Joy
 
A

akphidelt

You might be completely passed this but did you make sure that the value of
the combo box is selecting the write column in that combobox.

For instance lots of time when you create a combobox it automatically puts
in the ID as the # that goes along with the combobox choice.

Once again, you might already know this... but try going to the Immediate
Window in the VBE and type in ?Forms!yourform!ComboSpec2

Make sure the form is open and that there is a selection in the combobox.
This will tell you what value the combobox is pulling.

If its an ID number but not the text you want... change the code to

Select Case Me!ComboSpec2.Column(2)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top