T
Taher
Hi there
I have a form which has two option buttons. And there is a
combo box. I want to write a code which if
the option value is 1(user selects first option button)
and the combo box is null it gives a msgbox.
But when option is 2(user selects 2nd option button and
the combo box is null it does not give any message.
Also when option is 1 and combo box is not null it does
not give any message.
I tried to work on the code but its not working. Below is
the code
Private Sub Command149_Click()
On Error GoTo Err_Command149_Click
Dim msg, style, Mycheck, checkcriteria, response,
Mystring, style1, checkcriteria1, Mycheck1
Dim varEnteredvalue As Variant
msg = "Please enter Approver's Name!"
style = vbYesNo + vbExclamation
Msg1 = " Did you enter Approvers name!"
style = vbYesNo + vbExclamation
'checkcriteria = Forms![PROGRAM SIGN OFF]![PROGRAM SIGN
OFF Subform].Form!Frame23
checkcriteria = Forms![PROGRAM SIGN OFF]![PROGRAM SIGN
OFF Subform].Form!S_Name
Mycheck = IsNull(checkcriteria)
If varEnteredvalue = "1" And Mycheck = True Then
MsgBox msg, style
End If
Mycheck = IsNull(checkcriteria)
If varEnteredvalue = "2" And Mycheck = IsNull
(checkcriteria) Then
DoCmd.Close
End If
Mycheck = IsNull(checkcriteria)
If varEnteredvalue = "1" And Mycheck = False Then
DoCmd.Close
End If
Exit_Command149_Click:
Exit Sub
Err_Command149_Click:
MsgBox Err.Description
Resume Exit_Command149_Click
End Sub
I would appreciate if somebody can help resolve this issue.
Thank you.
I have a form which has two option buttons. And there is a
combo box. I want to write a code which if
the option value is 1(user selects first option button)
and the combo box is null it gives a msgbox.
But when option is 2(user selects 2nd option button and
the combo box is null it does not give any message.
Also when option is 1 and combo box is not null it does
not give any message.
I tried to work on the code but its not working. Below is
the code
Private Sub Command149_Click()
On Error GoTo Err_Command149_Click
Dim msg, style, Mycheck, checkcriteria, response,
Mystring, style1, checkcriteria1, Mycheck1
Dim varEnteredvalue As Variant
msg = "Please enter Approver's Name!"
style = vbYesNo + vbExclamation
Msg1 = " Did you enter Approvers name!"
style = vbYesNo + vbExclamation
'checkcriteria = Forms![PROGRAM SIGN OFF]![PROGRAM SIGN
OFF Subform].Form!Frame23
checkcriteria = Forms![PROGRAM SIGN OFF]![PROGRAM SIGN
OFF Subform].Form!S_Name
Mycheck = IsNull(checkcriteria)
If varEnteredvalue = "1" And Mycheck = True Then
MsgBox msg, style
End If
Mycheck = IsNull(checkcriteria)
If varEnteredvalue = "2" And Mycheck = IsNull
(checkcriteria) Then
DoCmd.Close
End If
Mycheck = IsNull(checkcriteria)
If varEnteredvalue = "1" And Mycheck = False Then
DoCmd.Close
End If
Exit_Command149_Click:
Exit Sub
Err_Command149_Click:
MsgBox Err.Description
Resume Exit_Command149_Click
End Sub
I would appreciate if somebody can help resolve this issue.
Thank you.