Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / March 2007

Tip: Looking for answers? Try searching our database.

Print form before closing...

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Outatym - 15 Mar 2007 15:43 GMT
I have a form that I need the user to print before they close.  The only way
for them to close the form is by clicking the "X" button in the top right
corner of the window.

I have to code set up as:

Private Sub Form_Close()
Dim intResponse As Integer
   
intResponse = MsgBox("Have you printed the form?", vbYesNoCancel, "Print
Form")
If intResponse = 6 Then
   DoCmd.Close
ElseIf intResponse = 7 Then
   DoCmd.CancelEvent
   DoCmd.PrintOut
   DoCmd.Close
ElseIf intResponse = 2 Then
   DoCmd.CancelEvent
End If

End Sub

But, apparently you can't print the form once the form has been initiated to
close.  I thought that canceling the even would make the form stop from
closing, but apparently I was wrong.

How can i re-code this to make it so when the user closes the form, a
message box will appear and ask if they have printed the form.  If so, then
the form closes, if not then the form will print, and if they closed the form
accidentally, the cancel button will cancel the form close event?

Thanks!
missinglinq - 15 Mar 2007 16:11 GMT
In the properties box for your form set "Close Button" property to NO.

Place a command button on your form and place your code in the button's On
Click event.

Signature

There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.