From: Jesse via AccessMonster.com on
Thank you for your input. To get it to work on the report open I used this.

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 = vbCancel Then
DoCmd.CancelEvent
End If

The docmd.canceEvent works good except it maximizing the form. I have the
code on the report to maximize on open and restore on close to restore the
form to the size i have it. But if you press the cancel button it still
maximizes the form and does not complete the restore docmd. Not a huge deal
but still would be nice to have it work clean. If you have any insite on this
issue I would be happy to listen and learn. Thanks

BruceM wrote:
>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.
>
>>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
>[quoted text clipped - 5 lines]
>>>>> All
>>>>> you're doing is presenting a message!

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201002/1

From: BruceM via AccessMonster.com on
Maximizing which form? Are you referring to code in the command button that
opens the report? You could try Cancel = True rather than DoCmd.CancelEvent,
but I doubt it will make a difference?

Jesse wrote:
>Thank you for your input. To get it to work on the report open I used this.
>
>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 = vbCancel Then
>DoCmd.CancelEvent
>End If
>
>The docmd.canceEvent works good except it maximizing the form. I have the
>code on the report to maximize on open and restore on close to restore the
>form to the size i have it. But if you press the cancel button it still
>maximizes the form and does not complete the restore docmd. Not a huge deal
>but still would be nice to have it work clean. If you have any insite on this
>issue I would be happy to listen and learn. Thanks
>
>>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
>[quoted text clipped - 5 lines]
>>>>>> All
>>>>>> you're doing is presenting a message!

--
Message posted via http://www.accessmonster.com

From: Jesse via AccessMonster.com on
I have a form that is built as a switchboard. When I press a command it
follows the handle number then opens a report. On the report properties I
have event procedures on the "On Open" and "On Close". the on open I tell it
to maximize and on the on close I tell it to restore. I have the form not
maximized in the access database but when you maximize a report it maximizes
the form unless you tell it to restore on close. then it puts the form window
back to the size you have previously set. So when I use the code below and
the user presses ok the report runs and on close the form is restored. But if
the user presses the cancel button the form stays maximized because for some
reason the restore command doesn't occur.

BruceM wrote:
>Maximizing which form? Are you referring to code in the command button that
>opens the report? You could try Cancel = True rather than DoCmd.CancelEvent,
>but I doubt it will make a difference?
>
>>Thank you for your input. To get it to work on the report open I used this.
>>
>[quoted text clipped - 19 lines]
>>>>>>> All
>>>>>>> you're doing is presenting a message!

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201002/1

From: BruceM via AccessMonster.com on
Try restoring (Me.Restore) in the Activate event of the form. Restoring in
the Close event of the report applies Restore to that report, not to any
other object. I'm not sure why it works as you would like in one instance
but not the other, but I do think the code needs to be in the form's Activate
event.

Jesse wrote:
>I have a form that is built as a switchboard. When I press a command it
>follows the handle number then opens a report. On the report properties I
>have event procedures on the "On Open" and "On Close". the on open I tell it
>to maximize and on the on close I tell it to restore. I have the form not
>maximized in the access database but when you maximize a report it maximizes
>the form unless you tell it to restore on close. then it puts the form window
>back to the size you have previously set. So when I use the code below and
>the user presses ok the report runs and on close the form is restored. But if
>the user presses the cancel button the form stays maximized because for some
>reason the restore command doesn't occur.
>
>>Maximizing which form? Are you referring to code in the command button that
>>opens the report? You could try Cancel = True rather than DoCmd.CancelEvent,
>[quoted text clipped - 5 lines]
>>>>>>>> All
>>>>>>>> you're doing is presenting a message!

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201002/1

From: Jesse via AccessMonster.com on
I placed the me.restore in the activate event and it gave me an error of
"Application-defined or abject-defined error". After I typed the . it didnt
show restore in the list of objects that i could use. So it doesnt work in
the activate event. Im not sure why it works in one instance but not the
other either. Access can be strange sometimes.

BruceM wrote:
>Try restoring (Me.Restore) in the Activate event of the form. Restoring in
>the Close event of the report applies Restore to that report, not to any
>other object. I'm not sure why it works as you would like in one instance
>but not the other, but I do think the code needs to be in the form's Activate
>event.
>
>>I have a form that is built as a switchboard. When I press a command it
>>follows the handle number then opens a report. On the report properties I
>[quoted text clipped - 12 lines]
>>>>>>>>> All
>>>>>>>>> you're doing is presenting a message!

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201002/1