How can I keep form from closing?

J

Jeff

I click on cmdPrintRMAwReturn on frmMainSwitchboard to open
rptRMAShippingFormNoReturn, which is coded as follows:

Private Sub Report_Close()

DoCmd.Close acForm, "frmFindRMANoReturn"

End Sub
Private Sub Report_Open(Cancel As Integer)

DoCmd.OpenForm "frmFindRMANoReturn", , , , , acDialog

End Sub

This opens frmFindRMANoReturn and the user inputs the RMA#, clicks
cmdPreviewRMANoReturn, which is coded as follows:

Private Sub cmdPreviewRMANoReturn_Click()
Me.Visible = False
End Sub

The report opens in Print Preview to the specific record, and
frmFindRMANoReturn closes as soon as cmdPreviewRMANoReturn is clicked.
However, frmMainSwitchboard closes at the same time. How can I keep
frmMainSwitchboard from closing?
 
J

John Mishefske

Jeff said:
However, frmMainSwitchboard closes at the same time. How can I keep
frmMainSwitchboard from closing?

Every form has an Unload event that can be sunk (handled). The event
provides an Integer value named "Cancel". Setting this value to a number
other than 0 will prevent the form from closing.

Private Sub Form_Unload(Cancel As Integer)

DoCmd.Hourglass False
Me.TimerInterval = 0 ' ensure timer is turned off
Cancel = True ' this form never closes!

End Sub

--
John Mishefske, Microsoft MVP 2007 - 2009
UtterAccess Editor
Tigeronomy Software
web: http://www.tigeronomy.com
email: sales ~at~ tigeronomy.com
 
G

Gina Whipp

Private Sub cmdPreviewRMANoReturn_Click()
Me.Visible = False
End Sub


It's the Me.Visible = False that is making your form Not Visible. Taking
away that line should make the frmMainSwitchboard remain Visible.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top