I've got a form with a command button that opens another form and I'm trying to make it open 1 of 2 possible forms (ABCD or EFGH) based on criteria: Here is the code:
Private Sub Command35_Click()
On Error GoTo Err_Command35_Click
If (Field1.Text = "ABCD") Then
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "ABCD_Form"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else:
stDocName = "EFGH_Form"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
Exit_Command35_Click:
Exit Sub
Err_Command35_Click:
MsgBox Err.Description
Resume Exit_Command35_Click
End Sub
I get an error You can't regerence a property or method for a control unless the control has focus. Any suggestions are appreciated. Tks!