Code for cascading box

  • Thread starter Thread starter Erin Freeman
  • Start date Start date
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.
 
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
 
Back
Top