Using Access 2010. I need to run 2 queries with a command button, giving the user the option to cancel out.
The debugger highlights MsgBox as above with the error:
"Compile error: argument not optional"
As a newbie I just figured if I put a message box in that had the option to cancel, it would do exactly that. So now I need to figure out how to tell it to actually cancel the action if user chooses so.
jeds
Code:
Private Sub MoveToLife_Click()
On Error GoTo MoveToLife_Click_Err
DoCmd.RunCommand acCmdRefresh
DoCmd.OpenQuery "MoveToLifeQ", acViewNormal, acEdit
Beep
MsgBox "Are you sure you want to remove this member from the active member list? This cannot be reversed!", vbOKCancel, "Please Confirm"
If [COLOR=red]MsgBox[/COLOR] = vbOK Then
DoCmd.OpenQuery "RemoveFromMembers", acViewNormal, acEdit
ElseIf MsgBox = vbCancel Then
Exit Sub
End If
MoveToLife_Click_Exit:
Exit Sub
MoveToLife_Click_Err:
MsgBox Error$
Resume MoveToLife_Click_Exit
End Sub
The debugger highlights MsgBox as above with the error:
"Compile error: argument not optional"
As a newbie I just figured if I put a message box in that had the option to cancel, it would do exactly that. So now I need to figure out how to tell it to actually cancel the action if user chooses so.
jeds