row source

S

Scrappy

I have created a form with a subform. I have a field with a combo box in the
form with 2 field names to choose from. I also have a field in the subform
with a combo box and depending on which field I choose in the form, I would
like to have a corresponding table show up. Do this make sense? How do I do
this?
 
D

Dirk Goldgar

Scrappy said:
I have created a form with a subform. I have a field with a combo
box in the form with 2 field names to choose from. I also have a
field in the subform with a combo box and depending on which field I
choose in the form, I would like to have a corresponding table show
up. Do this make sense? How do I do this?

So you want to change the rowsource of the combo box on the subform
depending on what is chosen in the combo box on the main form. Is that
right? It would look roughly like this:

'----- start of example code -----
Private Sub cboMainFormCombo_AfterUpdate()

With Me!SubformName!cboSubformCombo

Select Case Me!cboMainFormCombo
Case "AAAAA"
.RowSource = "TableAAAAA"
Case "BBBBB"
.RowSource = "TableBBBBB"
Case Else
' don't know what you might want to do here ...
End Select

End With

End Sub
'----- end of example code -----
 
Top