HeyYouYesYouNoNotYouYou
New Member
- Joined
- Dec 17, 2013
- Messages
- 37
Hi,
I have got a data input form in access, and i would like a yes/no message box to appear when the "complete order" command button is pressed. The command button is linked to a macro which runs a set of queries in the completion process. I have tried writing VBA code to do this in access, however i am not too familiar with writing vba in access and cannot understand a problem that i encountered. I transferred the original macro to vba code and then added in my own message box macro, however when the button is pressed, the message box code seems to be ignored and the macro just runs anyway. However when trying the message box code by itself, it runs. Can anybody suggest anything that could help me out on this?
This is the vba that i used, if it would be any help
Thanks in advance,
Heyyouyesyounonotyouyou
I have got a data input form in access, and i would like a yes/no message box to appear when the "complete order" command button is pressed. The command button is linked to a macro which runs a set of queries in the completion process. I have tried writing VBA code to do this in access, however i am not too familiar with writing vba in access and cannot understand a problem that i encountered. I transferred the original macro to vba code and then added in my own message box macro, however when the button is pressed, the message box code seems to be ignored and the macro just runs anyway. However when trying the message box code by itself, it runs. Can anybody suggest anything that could help me out on this?
This is the vba that i used, if it would be any help
Code:
Const cstrPrompt As String = _
"Are you sure you want to save this record? Yes/No"
If MsgBox(cstrPrompt, vbQuestion + vbYesNo) = vbNo Then
Cancel = True
DoCmd.SetWarnings False
DoCmd.OpenQuery "complete", acViewNormal, acEdit
DoCmd.OpenQuery "delte_orders", acViewNormal, acEdit
DoCmd.Close acForm, "Orders"
DoCmd.SetWarnings True
Thanks in advance,
Heyyouyesyounonotyouyou