I have a form that has two Option buttons (IP and OP),
And I have a command button which runs a macro which then displays a report.
How can I link the check boxes to the command button so that if 'IP' is selected then it should run Macro 1 and if 'OP' was selected then Macro 2 will run after the command buttons is pressed?
This is my code for the command button
but when i run it, i get the following error....
'Object doesn't support this property or method'
And I have a command button which runs a macro which then displays a report.
How can I link the check boxes to the command button so that if 'IP' is selected then it should run Macro 1 and if 'OP' was selected then Macro 2 will run after the command buttons is pressed?
This is my code for the command button
Code:
Private Sub Command7_Click()
On Error GoTo Err_Command7_Click
If Nz(Me.SearchBox.Value, "") = "" Then
MsgBox "Please enter a unit numnber!"
Exit Sub
Else
Dim stDocName As String
If IP = True And OP = False Then
DoCmd.RunMacro "Macro1"
ElseIf OP = True And IP = False Then
DoCmd.RunMacro "Macro2"
ElseIf IP = True And OP = True Then
MsgBox "Check one option only"
Else
End If
End If
DoCmd.RunMacro stDocName
Exit_Command7_Click:
Exit Sub
Err_Command7_Click:
MsgBox Err.Description
Resume Exit_Command7_Click
End Sub
but when i run it, i get the following error....
'Object doesn't support this property or method'