If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Cancel Button not working
I have a message pop up when a command button is pressed to run a report. The
problem is the cancel button is not cancelling the action. It still runs the report like you pressed ok. What am I missing? Response = MsgBox("Approximate wait time is 5 minutes." _ & Chr(10) & Chr(13) & _ "Push OK to continue,Cancel to Quit", 1) -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/201002/1 |
#2
|
|||
|
|||
Cancel Button not working
Perhaps you need to go back and look at Access Help for MsgBox!
Your posted code doesn't even include what buttons you want to appear on the messagebox, much less what you want to do according to the button pushed! All you're doing is presenting a message! -- There's ALWAYS more than one way to skin a cat! Answers/posts based on Access 2000/2003 Message posted via http://www.accessmonster.com |
#3
|
|||
|
|||
Cancel Button not working
Ok, All im trying to accomplish is a msg that pops up and states a run time
then as an OK or Cancel button. If the ok is pressed then continue with the command action or if cancel is pressed then cancel the command action. Linq Adams wrote: Perhaps you need to go back and look at Access Help for MsgBox! Your posted code doesn't even include what buttons you want to appear on the messagebox, much less what you want to do according to the button pushed! All you're doing is presenting a message! -- Message posted via http://www.accessmonster.com |
#4
|
|||
|
|||
Cancel Button not working
Actually, the posted code DOES include what buttons should appear. The ", 1"
after the text corresponds to vbOkCancel. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Linq Adams via AccessMonster.com" u28780@uwe wrote in message news:a408923c31ce3@uwe... Perhaps you need to go back and look at Access Help for MsgBox! Your posted code doesn't even include what buttons you want to appear on the messagebox, much less what you want to do according to the button pushed! All you're doing is presenting a message! -- There's ALWAYS more than one way to skin a cat! Answers/posts based on Access 2000/2003 Message posted via http://www.accessmonster.com |
#5
|
|||
|
|||
Cancel Button not working
Private Sub MyButton_Click()
Dim Response As Long Response = MsgBox("Approximate wait time is 5 minutes." _ & Chr(13) & Chr(10) & _ "Push OK to continue,Cancel to Quit", vbOkCancel) If Response = vbOk Then DoCmd.OpenReport ... End If End Sub -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Jesse via AccessMonster.com" u50870@uwe wrote in message news:a408b0b3f5930@uwe... Ok, All im trying to accomplish is a msg that pops up and states a run time then as an OK or Cancel button. If the ok is pressed then continue with the command action or if cancel is pressed then cancel the command action. Linq Adams wrote: Perhaps you need to go back and look at Access Help for MsgBox! Your posted code doesn't even include what buttons you want to appear on the messagebox, much less what you want to do according to the button pushed! All you're doing is presenting a message! -- Message posted via http://www.accessmonster.com |
#6
|
|||
|
|||
Cancel Button not working
Sorry, Doug, I missed that! But, of course, the code did nothing depending on
which button was pressed! -- There's ALWAYS more than one way to skin a cat! Answers/posts based on Access 2000/2003 Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/201002/1 |
#7
|
|||
|
|||
Cancel Button not working
Thank you for your help Douglas. I have incerted the code you provided and I
am recieving the same results as my code. Upon clicking the ok button the report runs. But if the cancel button is click the report still runs. I would like the cancel button to cancel the action and return to the form. Here is what I have on my report open. Again thank you for the help. Private Sub Report_Open(Cancel As Integer) Dim Response As Long Response = MsgBox("Approximate wait time is 5 minutes." _ & Chr(13) & Chr(10) & _ "Push OK to continue,Cancel to Quit", vbOKCancel) If Response = vbOK Then DoCmd.OpenReport "Picks Hourly - 24hr" End If DoCmd.Maximize End Sub Douglas J. Steele wrote: Actually, the posted code DOES include what buttons should appear. The ", 1" after the text corresponds to vbOkCancel. Perhaps you need to go back and look at Access Help for MsgBox! [quoted text clipped - 3 lines] All you're doing is presenting a message! -- Message posted via http://www.accessmonster.com |
#8
|
|||
|
|||
Cancel Button not working
I have fixed my problem with a different path. I placed the code on the
command click instead of having it on the report open. It works the way its suppose to now. Thank you again for your help. Jesse wrote: Thank you for your help Douglas. I have incerted the code you provided and I am recieving the same results as my code. Upon clicking the ok button the report runs. But if the cancel button is click the report still runs. I would like the cancel button to cancel the action and return to the form. Here is what I have on my report open. Again thank you for the help. Private Sub Report_Open(Cancel As Integer) Dim Response As Long Response = MsgBox("Approximate wait time is 5 minutes." _ & Chr(13) & Chr(10) & _ "Push OK to continue,Cancel to Quit", vbOKCancel) If Response = vbOK Then DoCmd.OpenReport "Picks Hourly - 24hr" End If DoCmd.Maximize End Sub Actually, the posted code DOES include what buttons should appear. The ", 1" after the text corresponds to vbOkCancel. [quoted text clipped - 4 lines] All you're doing is presenting a message! -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/201002/1 |
#9
|
|||
|
|||
Cancel Button not working
You would have needed Cancel = True in the code to cancel the report opening.
Jesse wrote: I have fixed my problem with a different path. I placed the code on the command click instead of having it on the report open. It works the way its suppose to now. Thank you again for your help. Thank you for your help Douglas. I have incerted the code you provided and I am recieving the same results as my code. Upon clicking the ok button the [quoted text clipped - 20 lines] All you're doing is presenting a message! -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/201002/1 |
#10
|
|||
|
|||
Cancel Button not working
I meant to mention that Douglas posted code for the Click event of a command
button, not the report's Open event. You were trying to open a report in its own Open event. Jesse wrote: I have fixed my problem with a different path. I placed the code on the command click instead of having it on the report open. It works the way its suppose to now. Thank you again for your help. Thank you for your help Douglas. I have incerted the code you provided and I am recieving the same results as my code. Upon clicking the ok button the [quoted text clipped - 20 lines] All you're doing is presenting a message! -- Message posted via http://www.accessmonster.com |
|
Thread Tools | |
Display Modes | |
|
|