A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Cancel Button not working



 
 
Thread Tools Display Modes
  #1  
Old February 22nd, 2010, 10:24 PM posted to microsoft.public.access.forms
Jesse via AccessMonster.com
external usenet poster
 
Posts: 29
Default 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  
Old February 22nd, 2010, 10:32 PM posted to microsoft.public.access.forms
Linq Adams via AccessMonster.com
external usenet poster
 
Posts: 1,474
Default 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  
Old February 22nd, 2010, 10:46 PM posted to microsoft.public.access.forms
Jesse via AccessMonster.com
external usenet poster
 
Posts: 29
Default 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  
Old February 23rd, 2010, 02:27 AM posted to microsoft.public.access.forms
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default 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  
Old February 23rd, 2010, 02:29 AM posted to microsoft.public.access.forms
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default 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  
Old February 23rd, 2010, 03:29 AM posted to microsoft.public.access.forms
Linq Adams via AccessMonster.com
external usenet poster
 
Posts: 1,474
Default 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  
Old February 23rd, 2010, 03:24 PM posted to microsoft.public.access.forms
Jesse via AccessMonster.com
external usenet poster
 
Posts: 29
Default 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  
Old February 23rd, 2010, 03:30 PM posted to microsoft.public.access.forms
Jesse via AccessMonster.com
external usenet poster
 
Posts: 29
Default 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  
Old February 23rd, 2010, 04:38 PM posted to microsoft.public.access.forms
BruceM via AccessMonster.com
external usenet poster
 
Posts: 448
Default 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  
Old February 23rd, 2010, 04:41 PM posted to microsoft.public.access.forms
BruceM via AccessMonster.com
external usenet poster
 
Posts: 448
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:46 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.