Hi,
This is easy. The combo box is capturing a primary key for the value FallOfHeight, I assume. I also assume the user selects a field from the combo box, and then clicks a button to open the other form. Is there already a form that is opened somehow?
Anyway, you have to capture the value from the combo box, then check it in an If Then End If, like this:
(This example assumes that 1 is the PK for FallOfHeight.)
'==========
Private Sub btnYourButton_Click()
On Error GoTo Err_btnYourButton_Click
Dim stDocName As String
Dim intMyComboBox As Integer
intMyComboBox = Me.MyComboBoxName
If intMyComboBox = 1 Then
stDocName = "frmFallOfHeight"
DoCmd.OpenForm stDocName
Else
stDocName = "frmDefaultForm"
DoCmd.OpenForm stDocName
End If
Exit_btnYourButton_Click:
Exit Sub
Err_btnYourButton_Click:
MsgBox Err.Description
Resume Exit_btnUserName_Click
End Sub
'=====
You can also add link criteria if you need to open to a specific record based on the combo box selection, or another combo box or text box selection.
HTH
mmcdonal
|