Robbyp2001
Registered User.
- Local time
- Today, 04:33
- Joined
- Oct 8, 2011
- Messages
- 143
Hello folks
I wonder if someone could tell me where I'm going wrong?
I have a command button that produces a MsgBox which should give the options to 'Proceed' or to 'Cancel'.
Here's what I have:
Private Sub Command10_Click()
If MsgBox("continue?", vbQuestion + vbYesNo) = vbYes Then
DoCmd.SetWarnings False
DoCmd.OpenQuery "NewDeliveryUpdate1", acViewNormal, acEdit
DoCmd.OpenQuery "NewDeliveryUpdate2", acViewNormal, acEdit
DoCmd.OpenQuery "NewDeliveryUpdate3", acViewNormal, acEdit
DoCmd.OpenQuery "NewDeliveryUpdate4", acViewNormal, acEdit
DoCmd.SetWarnings True
Else
MsgBox "Add New Stock Function aborted"
End If
Refresh
End Sub
Two things are happening.
1. When I run the queries from the button, without the MsgBox code, it works no problem and the record goes blank on the form as it has now been appended to a different table and the original is filtered out. This is not happening after the button (with the MsgBox code behind it) is clicked once.
2. I have discovered that the process works with the MsgBox code in place, but only after clicking the button twice.
I think this process should be fairly straightforward but clearly I am doing something wrong.
I just want to give the user the message that something is about to happen if they proceed, but they have the option to 'abort' the action and continue as normal.
Rob
I wonder if someone could tell me where I'm going wrong?
I have a command button that produces a MsgBox which should give the options to 'Proceed' or to 'Cancel'.
Here's what I have:
Private Sub Command10_Click()
If MsgBox("continue?", vbQuestion + vbYesNo) = vbYes Then
DoCmd.SetWarnings False
DoCmd.OpenQuery "NewDeliveryUpdate1", acViewNormal, acEdit
DoCmd.OpenQuery "NewDeliveryUpdate2", acViewNormal, acEdit
DoCmd.OpenQuery "NewDeliveryUpdate3", acViewNormal, acEdit
DoCmd.OpenQuery "NewDeliveryUpdate4", acViewNormal, acEdit
DoCmd.SetWarnings True
Else
MsgBox "Add New Stock Function aborted"
End If
Refresh
End Sub
Two things are happening.
1. When I run the queries from the button, without the MsgBox code, it works no problem and the record goes blank on the form as it has now been appended to a different table and the original is filtered out. This is not happening after the button (with the MsgBox code behind it) is clicked once.
2. I have discovered that the process works with the MsgBox code in place, but only after clicking the button twice.
I think this process should be fairly straightforward but clearly I am doing something wrong.
I just want to give the user the message that something is about to happen if they proceed, but they have the option to 'abort' the action and continue as normal.
Rob