Z
zarkov4995
Guest
Hi guys,
I've spent half a day browsing the archives but I can't find a solution to my problem:
I got a main form with a alphabetically sorted combo box where I want to open a specific subform, based on the selection in the cbo. I can do it in an ugly way, using the primary key from the table used to populate the cbo, but I would like to use one of the visible columns in the cbo instead to make it clearer.
That is, instead of this:
Private Sub cboFruitType_AfterUpdate()
Select Case Me.cboFruitType.Value
Case 1
Me.Form4.SourceObject = "tblApples"
Case Else
Me.Form4.SourceObject = "frmPleaseChoose"
End Select
End Sub
I would like this:
Private Sub cboFruitType_AfterUpdate()
Select Case Me.cboFruitType.Value
Case "Apples"
Me.Form4.SourceObject = "tblApples"
Case Else
Me.Form4.SourceObject = "frmPleaseChoose"
End Select
End Sub
How do I get anything else than the primary key from the combobox? I guess VBA is the answer, but I can't figure out how...
I've spent half a day browsing the archives but I can't find a solution to my problem:
I got a main form with a alphabetically sorted combo box where I want to open a specific subform, based on the selection in the cbo. I can do it in an ugly way, using the primary key from the table used to populate the cbo, but I would like to use one of the visible columns in the cbo instead to make it clearer.
That is, instead of this:
Private Sub cboFruitType_AfterUpdate()
Select Case Me.cboFruitType.Value
Case 1
Me.Form4.SourceObject = "tblApples"
Case Else
Me.Form4.SourceObject = "frmPleaseChoose"
End Select
End Sub
I would like this:
Private Sub cboFruitType_AfterUpdate()
Select Case Me.cboFruitType.Value
Case "Apples"
Me.Form4.SourceObject = "tblApples"
Case Else
Me.Form4.SourceObject = "frmPleaseChoose"
End Select
End Sub
How do I get anything else than the primary key from the combobox? I guess VBA is the answer, but I can't figure out how...