Hi all,
Im using the below code to open a from depending on what option is selected on a combobox.
If you select the first item [One] it will open the correct form [TestOne]. But when you select any of the others an error comes up saying that the name is no a form. So I added
But the no items would select.
I know If split the reports form the forms and make two comboboxes it would work, but it would be better it both could be in the same combobox.
Can anyone help.
Thank you
Im using the below code to open a from depending on what option is selected on a combobox.
Code:
Private Sub DirectPCombo_Click()
Dim cboVal As String
Dim stDocName As String
cboVal = Me.DirectPCombo.Value
Select Case cboVal
Case "One"
stDocName = "TestOneFrm"
Case "OneRpt"
stDocName = "TestOneRpt"
Case "OneName"
stDocName = "TestOneByNameRpt"
Case "OneCode"
stDocName = "TestOneByCodeRpt"
End Select
DoCmd.OpenForm stDocName
End Sub
Code:
DoCmd.OpenReport stDocName
I know If split the reports form the forms and make two comboboxes it would work, but it would be better it both could be in the same combobox.
Can anyone help.
Thank you