Combo Box to Disable Pending on value from previous Combo Box

J

Joy

Hi, I am new to MS Access coding and would like help on...
I have a form that I created with text fields & combo boxes. In my form I
would like Combo Box 3 to be enabled for certain values selected in Combo Box
2 and likewise if they pick other values, then Combo Box 3 becomes disabled.
Could you pls help me out... Thanks
 
J

Jeff Boyce

In the AfterUpdate event for ComboBox2, add code that enables/disables
Combobox3. One way might look like (untested):

Select Case Me!Combobox2
Case 1, 2, 3
Me!Combobox3.Enabled = True
Case Else
Me!Combobox3.Enabled = False
End Select


Regards

Jeff Boyce
Microsoft Office/Access MVP
 
J

Joy

Hi Jeff

Is this what the code should look like:

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

ComboSpec3_1 does not become disabled when ComboSpec2 value selected is
Deputy Director.

Pls let me know how I can improve on this

Thx Joy
 
J

Jeff Boyce

Joy

If the combobox you are referring to is of standard construction, the first
field is hidden (width = 0) and is the rowID for the table that holds the
titles. The SECOND field probably holds the title (e.g., Director, ...).

Your code refers to the combobox, but since it doesn't specify which column,
Access uses the first.

Please post the SQL statement you are using to fill that combobox...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
J

Joy

Hi Jeff

Bound Col is 1. There is only 1 visible col

Hope I'm making sense?

Thanks Joy
 
J

Jeff Boyce

How many columns in the Row Source of the combobox? Post the SQL statement
you use to fill the combobox.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
J

Joy

Hi Jeff

Here it is:

SELECT tblComboSpec3.Specialty3
FROM tblComboSpec3
WHERE (((tblComboSpec3.[Specialty 2])=[forms]![NewProfReqForm]![ComboSpec2])
AND ((tblComboSpec3.Profession)=[forms]![NewProfReqForm]![ComboProfession])
AND ((tblComboSpec3.[Business Unit])=[forms]![NewProfReqForm]![ComboBU]));

Thanks Joy
 
J

Jeff Boyce

Joy

I may be reading too much into your descriptions...

In one of your earlier posts up-thread, you mention "Me!ComboSpec2" and
"Me!ComboSpec3_1". Is the different naming convention significant?

Aside from that, I'm not spotting anything right off.

Have you tried deleting the combobox you want to have appear/disappear and
re-creating it?


Regards

Jeff Boyce
Microsoft Office/Access MVP

Joy said:
Hi Jeff

Here it is:

SELECT tblComboSpec3.Specialty3
FROM tblComboSpec3
WHERE (((tblComboSpec3.[Specialty
2])=[forms]![NewProfReqForm]![ComboSpec2])
AND
((tblComboSpec3.Profession)=[forms]![NewProfReqForm]![ComboProfession])
AND ((tblComboSpec3.[Business Unit])=[forms]![NewProfReqForm]![ComboBU]));

Thanks Joy
Jeff Boyce said:
How many columns in the Row Source of the combobox? Post the SQL
statement
you use to fill the combobox.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

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

Similar Threads


Top