Code for cascading box

E

Erin Freeman

Hi there.

I have a table called MainArtifacts. This table has a field Called
Artifactcategories

I have a form in which i have two comboboxes.

The first combobox is called cboArtifactcategories, which has its row source
set to tblArtifactCategories

A second combobox called cboArtifactType, which has no row source set.

I have the following code writtin in the afterupdate of the first combo box

Private Sub cboArtifactCategories_AfterUpdate()
On Error Resume Next
Select Case cboArtifactCategories.Value
Case "Bifacial Tools"
cboArtifactType.RowSource = "tblBifacialTools"
Case "Debitage"
cboArtifactType.RowSource = "tblDebitage"
Case "Ground Stone / Cobble Tools"
cboArtifactType.RowSource = "tblGroundstonecobbletools"
Case "Historic"
cboArtifactType.RowSource = "tblHistoric"
Case "Microblade / Blade Core Reduction"
cboArtifactType.RowSource = "tblMicrobladeBladecorereduction"
Case "Other"
cboArtifactType.RowSource = "tblOther"
Case "Specialized Tools / Ceremonial"
cboArtifactType.RowSource = "tblSpecializedtools"
Case "Unifacial Tools"
cboArtifactType.RowSource = "tblUnifacialTools"
End Select


However, when i enter the information in on my form and then scroll back
through to make sure the combo boxes values are just what i chose they arent.
The first combo box is right but the 2nd combobox is blank. what am i doing
wrong :(

Thank you for taking the time to respond

The form is based on the main artifacts table.
 
J

Jeff Boyce

Erin

Perhaps the form doesn't "know" the second combobox has had its RowSource
(re-)set. Have you tried adding

Me!cboSecondCombobox.Requery

following setting the RowSource? (It doesn't seem right that you should
have to, but it hardly hurts to test it, right?)

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

Top