Question Doubt Regarding Cascading Combo Boxes (1 Viewer)

ds3010

New member
Local time
Today, 08:19
Joined
Nov 3, 2011
Messages
5
Hello again, I am new to Access 2007 and I need to create a database. I haven't created the forms yet I am just in the database layout.

I want to create Cascading Combo Boxes. Currently I have 9 tables, one for the database itself, one for the main combo box which is assigned to one of the fields on the database and 7 for the dependent combo boxes.

The name of the field on the database that contains the main combo box is named "Opportunity" and the field that will contain the dependent combo boxes is called "Participation", so I suppose the name of the combo boxes would be cboOpportunity and cboParticipation. (Please tell me if I'm wrong and where can I check the real combo boxes names).

I researched online and found out that I need to change the rowSource on the dependent combo box field in order to create the cascading. So this is what I do: After I successfully create the main combo box "Opportunity", I change the display control of the dependent combo box field (Participation) to "combo", I right click on row source and select "Build", then after a new window pops up I right click the display and select "SQL View", and issue the exact following code:

SELECT
Private Sub cboOpportunity_AfterUpdate()
On Error Resume Next
Select Case cboOpportunity.Value
Case "The Dialog Student Newspaper"
cboParticipation.RowSource = "tblDialog"
Case "The SA Campus Food Drive"
cboParticipation.RowSource = "tblFoodBank"
Case "The SA Green Team"
cboParticipation.RowSource = "tblGreen"
Case "The SA Outreach Team"
cboParticipation.RowSource = "tblOutreach"
Case "SA Club Involvement"
cboParticipation.RowSource = "tblClubs"
Case "SA Events"
cboParticipation.RowSource = "tblEvents"
Case "SA High Five Mondays Crew"
cboParticipation.RowSource = "tblHighFive"
End Select
End Sub

It is not working. Please help me out here!, I would really appreciate it.

Best Regards
 
Last edited:

spikepl

Eledittingent Beliped
Local time
Today, 14:19
Joined
Nov 3, 2010
Messages
6,142
And BTW: Banish the useless expression "not working" when asking for help. We are not mind readers and "not working" only says that you are unhappy with something. Always state what you want to do, what code did you use for that, what did the code do, and what error messages appeared - if any, and what did you expect to happen.
 

Users who are viewing this thread

Top Bottom