Cascading Combo box

R

Rpettis31

This is not working for some reason.

Private Sub cboCountry_AfterUpdate()
On Error Resume Next
Select Case cboIssueCategory.Value
Case "Cosmetic" & cboProductType="Frame"
cboIssueType.RowSource = "tblFrameCosmetic"
End Select
End Sub

Not sure if I am doing the after event right. This is a drop down that
displays the category it will then look back and see the product type and
then show the table with the Issues list for the type and category.
 
D

Dirk Goldgar

Rpettis31 said:
This is not working for some reason.

Private Sub cboCountry_AfterUpdate()
On Error Resume Next
Select Case cboIssueCategory.Value
Case "Cosmetic" & cboProductType="Frame"
cboIssueType.RowSource = "tblFrameCosmetic"
End Select
End Sub

Not sure if I am doing the after event right. This is a drop down that
displays the category it will then look back and see the product type and
then show the table with the Issues list for the type and category.


I'm not sure, but I think what you're looking for is something like this:

Select Case cboIssueCategory.Value

Case "Cosmetic"

If cboProductType = "Frame" Then
cboIssueType.RowSource = "tblFrameCosmetic"
End If
' ... and what if cboProductType is something else? ...

' ... any other cases? ...

End Select

What you were doing originally would not work to test for both values at
once.

Depending on how you have the other values in the combo boxes set, you might
conceivably be able to do something cute like this:

Me.cboIssueType.RowSource = _
"tbl" & Me.cboProductType & Me.cboIssueCategory

That would work in this example case, but probably wouldn't work in other
cases unless you'd intentionally set up the combo's rowsources to match the
table names, or vice versa.
 
R

Rpettis31

I tried that and I keep getting tblFrameCosmetic in the combox box instead of
the table. I had other cases but I commented them out thinking I had done
something wrong with the multiple case statements.

Private Sub cmbxIssueCategory_AfterUpdate()

On Error Resume Next



Select Case cmbxIssueCategory.Value

Case "Cosmetic"



If cmbxProductType = "Frames" Then

cmbxIssueType.RowSource = "tblFrameCosmetic"



'If cmbxProductType = "Album" Then

'cmbxIssueType.RowSource = "tblAlbumCosmetic"



'Case "Defective"

'If cmbxProductType = "Frames" Then

'cmbxIssueType.RowSource = "tblFrameDefective"

End If

End Select
End Sub
 
D

Dirk Goldgar

Rpettis31 said:
I tried that and I keep getting tblFrameCosmetic in the combox box instead
of
the table. I had other cases but I commented them out thinking I had done
something wrong with the multiple case statements.

Check the properties of the combo box "cmbxIssueType" to make sure that the
RowSourceType property is set to "Table/Query". It sounds to me as though
maybe it is set to "Value List".
 
D

Dale Fye

The other thing you should check is whether the combo box has 1 or 2 columns,
and what the bound column is. If it is 2, and the bound column is 1, and the
text "Cosmetic", "Defective", ... is in the second column then you should
test for:

Select case me.cmbxIssueCategory.column(1)
Case "Cosmetic"
If ...
elseif ....
endif
Case "Defective"
If ...
endif
Case else
Msgbox "invalid selection"
End Select

End Sub

HTH
Dale

--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.
 

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