Cascading Combo Boxes

jjmartin05

New Member
Joined
May 19, 2011
Messages
5
Hi Everyone,

I'm having some trouble with getting Cascading combo boxes to work on a DB I'm building. I've gotten it to work in prior DB's, but this time it's really frustrating me.

Using Access 2010, on Windows 7 64bit

I have included a link below to access the DB in question, since for some reason, I can't post attachments.

https://dl.dropboxusercontent.com/u/43471904/Lotbooks.zip

I have two tables, tblGradeUNS and tblSpec and the form which contains the cascading combos is subfrmAngle.

Basically, the user will first chose the combo box for "Grade", and then the combo box for "Spec" is supposed to update to only show the records where the "grade" matches.

The code that is being used is:
Code:
Private Sub cboGrade_AfterUpdate()
Me.txtUNS = Me.cboGrade.Column(1)

Me.cboSpec.RowSource = "SELECT strSpec FROM" & _
    " tblSpec WHERE GradeID = " & Me.cboGrade & _
    " ORDER BY strSpec"
    
Me.cboSpec = Me.cboSpec.ItemData(0)
End Sub

I really appreciate any help!

Thanks in advance!
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
You need to requery the second combo to see the updated values.

Change

Code:
Me.cboSpec = Me.cboSpec.ItemData(0)
to
Code:
Me.cboSpec.Requery

Denis
</pre>
 
Upvote 0
Hi Denis,

I updated as you suggested. Then when I choose the option from the first combo box, then when I click on the second combo box, it gives me an error: "Data type mismatch in criteria expression" I'm not sure why, as both the data types are set to "text"
 
Upvote 0
Are they Text in the tables?
And what is the bound column in the first combo? It should be the GradeID (presumably a Long Integer or AutoNumber), and it usually is hidden. If that is the case, set the format of the combo to General.

Denis
 
Upvote 0

Forum statistics

Threads
1,215,558
Messages
6,125,504
Members
449,235
Latest member
Terra0013

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top