R
Rowland
I have a message box that pops up, when an option is
choose. The message box should open a table when ok is
pressed, and should return to the option form when cancel
is pressed. However it opens the table no matter what
button is pressed. There is the code on the form
Private Sub cmd_ok_Click()
If (Me.opt_add_edit_menu.Value = 1 And opt_choices.Value
<> 5) Then
DoCmd.OpenForm "frm_search", acNormal
ElseIf (Me.opt_add_edit_menu.Value = 1 And
opt_choices.Value = 5) Then
MsgBox "This action will open the states table for
adding" & vbCrLf & "and/or editing and or deleting", _
vbOKCancel, "Are you sure?"
If vbOK = 1 Then
DoCmd.OpenTable "tbl_type_state", acViewNormal
DoCmd.Close acForm, "frm_add_edit_menu"
Else
Exit Sub
End If
ElseIf (Me.opt_add_edit_menu.Value = 2 And
opt_choices.Value = 5) Then
MsgBox "This action will open the states table for
adding" & vbCrLf & "and/or editing and/or deleting", _
vbOKCancel, "Are you sure?"
If (vbOK) Then
DoCmd.OpenTable "tbl_type_state", acViewNormal
DoCmd.Close acForm, "frm_add_edit_menu"
Else
Exit Sub
End If
End If
choose. The message box should open a table when ok is
pressed, and should return to the option form when cancel
is pressed. However it opens the table no matter what
button is pressed. There is the code on the form
Private Sub cmd_ok_Click()
If (Me.opt_add_edit_menu.Value = 1 And opt_choices.Value
<> 5) Then
DoCmd.OpenForm "frm_search", acNormal
ElseIf (Me.opt_add_edit_menu.Value = 1 And
opt_choices.Value = 5) Then
MsgBox "This action will open the states table for
adding" & vbCrLf & "and/or editing and or deleting", _
vbOKCancel, "Are you sure?"
If vbOK = 1 Then
DoCmd.OpenTable "tbl_type_state", acViewNormal
DoCmd.Close acForm, "frm_add_edit_menu"
Else
Exit Sub
End If
ElseIf (Me.opt_add_edit_menu.Value = 2 And
opt_choices.Value = 5) Then
MsgBox "This action will open the states table for
adding" & vbCrLf & "and/or editing and/or deleting", _
vbOKCancel, "Are you sure?"
If (vbOK) Then
DoCmd.OpenTable "tbl_type_state", acViewNormal
DoCmd.Close acForm, "frm_add_edit_menu"
Else
Exit Sub
End If
End If