Closing Access While Form Is In Print Preview Does Not Trigger Form Unload Event

We use the form unload event of our main form to make sure the user exist
through our exit process instead of just closing access with the top right X
on the access application.  This works if the form is in form view.

However, if the user uses the Office button to do a Print\Preview and then
clicks on the top right X on the access application access closes without
triggering the form unload event.

Is this by design or a bug?  Is there away around this behavior?  Is there a
way to prevent a form from going into print preview mode while still
allowing the use of the Office button Print\Preview for reports?

0
Stewart
6/4/2010 10:30:53 PM
access.formscoding 7493 articles. 0 followers. Follow

3 Replies
1577 Views

Similar Articles

[PageSpeed] 33

I use this sort of thing on the unload event of a form that is always open 
and hidden.

Private Sub Form_Unload(Cancel As Integer)
'if user has report open, gives chance to say no
'if they clicked the main app X by mistake
'and runs the quit actions code before access closes

    'Debug.Print Reports.Count
    If Reports.count > 0 Then
        If vbCancel = MsgBox("Are you sure you want to close the 
database?", vbOKCancel, Close?) Then
            Cancel = True
       Else
            'code here to call the exit routine
        End If
    End If
End Sub

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

"Stewart Berman" <saberman@nospam.nospam> wrote in message 
news:1kvi0655kbngmk6jdqoo0i88l00vpvjooh@4ax.com...
> We use the form unload event of our main form to make sure the user exist
> through our exit process instead of just closing access with the top right 
> X
> on the access application.  This works if the form is in form view.
>
> However, if the user uses the Office button to do a Print\Preview and then
> clicks on the top right X on the access application access closes without
> triggering the form unload event.
>
> Is this by design or a bug?  Is there away around this behavior?  Is there 
> a
> way to prevent a form from going into print preview mode while still
> allowing the use of the Office button Print\Preview for reports?
> 


0
Jeanette
6/5/2010 10:55:44 PM
We original tried that but the main form has to do a good deal of cleanup
before closing and there was no way to stop it from being closed before the
form unload event in the invisible form is invoked.  Once application close
is invoked by clicking on the X there is no guarantee as to the order access
will close open objects.

"Jeanette Cunningham" <nnn@discussions.microsoft.com> wrote:

>I use this sort of thing on the unload event of a form that is always open 
>and hidden.
>
>Private Sub Form_Unload(Cancel As Integer)
>'if user has report open, gives chance to say no
>'if they clicked the main app X by mistake
>'and runs the quit actions code before access closes
>
>    'Debug.Print Reports.Count
>    If Reports.count > 0 Then
>        If vbCancel = MsgBox("Are you sure you want to close the 
>database?", vbOKCancel, Close?) Then
>            Cancel = True
>       Else
>            'code here to call the exit routine
>        End If
>    End If
>End Sub
>
>Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
>
>"Stewart Berman" <saberman@nospam.nospam> wrote in message 
>news:1kvi0655kbngmk6jdqoo0i88l00vpvjooh@4ax.com...
>> We use the form unload event of our main form to make sure the user exist
>> through our exit process instead of just closing access with the top right 
>> X
>> on the access application.  This works if the form is in form view.
>>
>> However, if the user uses the Office button to do a Print\Preview and then
>> clicks on the top right X on the access application access closes without
>> triggering the form unload event.
>>
>> Is this by design or a bug?  Is there away around this behavior?  Is there 
>> a
>> way to prevent a form from going into print preview mode while still
>> allowing the use of the Office button Print\Preview for reports?
>> 
>
0
Stewart
6/6/2010 10:57:47 PM
Yes there is, access closes down forms in order.
The first opened form (of the forms that are still open) is the last one to 
be closed.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

"Stewart Berman" <saberman@nospam.nospam> wrote in message 
news:sk9o061oe3dm665mfrqjvtgfcbo4k299sh@4ax.com...
> We original tried that but the main form has to do a good deal of cleanup
> before closing and there was no way to stop it from being closed before 
> the
> form unload event in the invisible form is invoked.  Once application 
> close
> is invoked by clicking on the X there is no guarantee as to the order 
> access
> will close open objects.
>
> "Jeanette Cunningham" <nnn@discussions.microsoft.com> wrote:
>
>>I use this sort of thing on the unload event of a form that is always open
>>and hidden.
>>
>>Private Sub Form_Unload(Cancel As Integer)
>>'if user has report open, gives chance to say no
>>'if they clicked the main app X by mistake
>>'and runs the quit actions code before access closes
>>
>>    'Debug.Print Reports.Count
>>    If Reports.count > 0 Then
>>        If vbCancel = MsgBox("Are you sure you want to close the
>>database?", vbOKCancel, Close?) Then
>>            Cancel = True
>>       Else
>>            'code here to call the exit routine
>>        End If
>>    End If
>>End Sub
>>
>>Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
>>
>>"Stewart Berman" <saberman@nospam.nospam> wrote in message
>>news:1kvi0655kbngmk6jdqoo0i88l00vpvjooh@4ax.com...
>>> We use the form unload event of our main form to make sure the user 
>>> exist
>>> through our exit process instead of just closing access with the top 
>>> right
>>> X
>>> on the access application.  This works if the form is in form view.
>>>
>>> However, if the user uses the Office button to do a Print\Preview and 
>>> then
>>> clicks on the top right X on the access application access closes 
>>> without
>>> triggering the form unload event.
>>>
>>> Is this by design or a bug?  Is there away around this behavior?  Is 
>>> there
>>> a
>>> way to prevent a form from going into print preview mode while still
>>> allowing the use of the Office button Print\Preview for reports?
>>>
>> 


0
Jeanette
6/7/2010 2:15:39 AM
Reply:

Similar Artilces:

Printing Multiple Receipts at a Time From Journal
Hey guys, Is there a way to print multiple journaled receipts at a time? Say all receipts for a batch or by date or other criteria? Thanks Tom, Not that I've seen. -- = Get Secure! - www.microsoft.com/security You must be using Outlook Express or some other type of newsgroup reader to see and download the file attachment. If you are not using a reader, follow the link below to setup Outlook Express. Click on "Open with newsreader" under the MS Retail Management System on the right. http://tinyurl.com/75bgz ========== "Tom Bombadill" <Genius_pos...

Passing data from one form to another
Hello I have a form called frmMaindB and it has 5 text boxes on it (txtEmployeeTime, txtDTRegular, txtDTReason1, txtDTReason2, txtDTMaintenance) when I double click on the text box it opens up a pop up form named frm_DecimalConversion. On this form I have two text boxes one box I enter data into and the other calculates or converts the data to a decimal. The box that converts the data is called txtDecimal. Then I have a close button which I want to use to close the pop up form and insert the data into the text box I double clicked in to get the pop up or (frm_DecimalConversion). I have r...

data value in Form field if no table entry
I have a form with a field which pulls through and concentenates 2 fields called [ContactFirstname] and [ContactLastName]from my table There are however some customers for whom I do not have names and therefore instead I would like Sir/Madam to appear in the field in the form I think I have seen this done somewhere using ELSE? but can't find it Any help/ideas gratefully received Perhaps something like this: Nz(Trim([ContactFirstname] & " " + [ContactLastName]), "Sir/Madam") -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access use...

Computer Check Printing
Computer Checks Edit List is for a check run for one country (all the vendors in that countrY), but the vendors from another country show up as zero dollars. Any idea how to prevent this? It does not appear to be related to KB# 874437, as electronic payments are not used. Thanks in advance. ...

making an equation in access
Hi, I would like to create a field that works out a formula based on other fields. i.e field z=field4, when field 1<field 2 - field 3 etc. Yes, it may be a silly question but I am only new to this....Thanks, Dani. Dani, recommend against creating a "field" in a table and storing this value. One of the generally accepted rules of relational database development is not to store a "computed" (any value that is based on the value of other fields in your database) value in the table. It is a waste of database space, and will eventually result in bad data (...

Printing Multiple Copies #4
Hi all - I am using Vista Business and Publisher 2007 from the Office 2007 Small Business package. No matter what type of publication or template I use I can only print single copies. Most recently I tried to print 30 copies of a single page flyer and had to do it a single copy at a time. If I go to File|Print and set the number of copies to 30, I still get a single copy only. Does anyone have any thoughts? Thanks -- Andrew Aitchison (amhsn@nospam.sympatico.ca) Is your printer driver current? What is the default in the printing preferences in the control panel printer folder? ...

Outlook 2003: Print address book
I'm running Outlook 2003 as a stand alone program without a network. I can't print the address book. The address book menu does not offer any print options including those found in the Help and Support and the MS Knowledge Base. It also doesn't offer the option to export/import. What am I missing here? Operating Windows XP Home SP2, IE 6 SP2, Outlook 2003. Thanks for any suggestion -- Phil pdischert@iname.com There is no address book in Outlook. There are lots of choices for ways to print your Contacts Folder: http://www.slipstick.com/contacts/print.htm -- Russ V...

Article published by Microsoft reg. 'Event' custom entity
Recently, I found a great article published by Microsoft that contains a sample code on how to create a custom entity, event. I thought that I bookmarked it but cannot find it. Has anyone seen it and can provide a hyperlink? I will really appreciate it. http://msdn2.microsoft.com/en-us/library/aa682866.aspx you'll probably find it in the above link "mkatsev" wrote: > Recently, I found a great article published by Microsoft that contains a > sample code on how to create a custom entity, event. I thought that I > bookmarked it but cannot find it. Has anyone seen...

form and query problem. please help.
All tables are linked with weak entities. However, when i enter data on the form I can't get it to let me enter more than one partipicant without access generating a new invoice id. however i need one invoice to many participants. It wont work and i have no idea what to do at this point. in addition the workshop will not let me add workshop to invoice. this is a small mdb and i'd like to email it to anyone who can assist me with the relationships as I think this is the problem but I don't know what to do. please help me. INVOICE invoiceNO - autonumber invoice prices WORKSHOP wo...

Printing Non-Avery labels with Zebra TLP-3843
Hello. I'm trying to figure out the best way to print labels and tags for jewelry products using the Zebra 3843...example would be a rat-tail label (overall size: 9/16 x 4 7/16 with printable area of 9/16 x 2 1/2")...one half would be for bar code and other half would be for ILC description, price and store name. Is the label designer capable of doing this if you build a label from scratch? When I try to open the existing Zebra .lbl template it says "BarcodeBlaster style labels can not be edited with the Label Editor. See Store Operations documentation for assistance ...

Printing Word and excel documents via excel vba
I have a document that has some Excel and some word content i would like to use excel vba to print both a page from word and then a page from excel. I know how to select and open the word document, however i cant find any code to print page X from word. basically i need to: print page 1 of c:\xx\document1.doc print page1 of sheet1 of c:\yy\excelwkbk1.xls print page 2 of c:\xx\document1.doc print page2 of sheet1 of c:\yy\excelwkbk1.xls and so on it will require moving between word and excel - the excel bit i get, but getting back to excel from word, and printing out in word is slightly more...

Using Excel spreadsheet as input to Access
Hello, I posted this in the New Users forum but only got one answer, so thought I'd try here as well. Like so many others, I am an Excel newbie. I was a mainframe COBO programmer in another life, but that was a few years back My manager would like me to write an app that will take tracking dat from an existing Excel spreadsheet (generated by our system) but onl use a select handful of columns as input to a new Access database tha I will create. I'm guessing that I can either a) create a new edited spreadsheet to b used as input to the Access database or b) use the Import wiza...

Print Vertical Banner in Pub 2000
Is it possible to print a vertically oriented banner with Publisher 2000? I have made many horizontally oriented banners, and would like to attempt a vertically oriented one. Any tips? Help... ...

Outlook should keep files in the clipboard after closing a window
When you open a message (in a new window) in Outlook 2007, and copy one or more files contained in this message, and then close the window, the file is not kept in the clipboard. I have to copy the file and paste it before closing the window. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I ...

Print from Outlook to Avery Rolodex Cards
I am unable to find any way to print my Outlook contacts list on Avery Small Rotary Cards #8385. Please advise. And thanks much. S ...

Access To Word Mailmerge
I have setup a Mailmerge that is run from Access. The process works like this: 1) The proper record is selected in an Access form which automatically starts the process. 2) Word is called up automatically, it shows both the template and the doument with the proper data in it. 3) Access is closed automatically. 4) The user then needs to close the mailmerge template. 5) The document with the proper mailmerge information inserted from Access is up on the screen. At this point a shortcut is triggered by the user that adds a document of the users choice to the end of the curre...

Outlook Web Access HTTP 500 and HTTP 404 errors
hi, I am experiencing this problem on Exchange 2003 on Windows 2003, when the users try to authenticate to Outlook Web Access, they get the following error messages in their browsers, "http 500 - internal server error" or "http error 404 - file or directory not found", the customer upgraded to windows/exchange 2003 6 months ago from windows/Exchange 2000 (in place upgrade), they only discovered the problem last week when they tried creating new users, i created 3 test users and the 3 users were getting the above errors. some already existing users have no prob...

E-Newsletter Doesn't Print All Pages
Outlook 2003 & 2007 =================== Hello, I have a customer who designs and sends out an E-Newsletter in MS Publisher. When I receive the e-newsletter and try to print it, it does not print all of the pages of the newsletter. Typically it only prints the first page (of 3 pages). I realize most would recommend that the customer send it out as a PDF attachment, but the preference is to send it out as an e-newsletter. Any thoughts on why I can not print all of the pages in the newsletter and what I can do to make it work? Thanks for giving this some thought. w...

Form Formatting
I have a subform (datasheet view) in a form where I want to make one column a different color. I can go into Design view and change the color but it doesn't change in the form view. This form was made ages ago with an automatic format and now I can't get away from the automatic format. Help! "DSmith" <donna@DONTSPAMresxrn.com> wrote in message news:eQARsjI6KHA.4508@TK2MSFTNGP06.phx.gbl... >I have a subform (datasheet view) in a form where I want to make one column >a different color. I can go into Design view and change the color but it >doe...

Printing reconciliation
Is there a way to print a reconciliation report wich shows outstanding checks and deposits in transit, etc? Thanks, Craig In microsoft.public.money, Craig wrote: >Is there a way to print a reconciliation report wich shows outstanding >checks and deposits in transit, etc? > You can customize a report similar to the way described in how to make a report like bank statement/reconciliation: http://support.microsoft.com/default.aspx?scid=kb;en-us;176329 You would customize to show transactions that had not been cleared. Check the other tabs for more things you can customize. Then...

telnet client in access form
Hello. I am trying to creat a form for work that involves connecting to a telnet server to automatically send and retreive specified data. I am new to VB and I am not sure why my code is not working... anybody help me out? Here is the code that seems to be generating the error: Private Sub Form_Open(Cancel As Integer) telnet.RemoteHost = "HOST" telnet.RemotePort = 23 End Sub (obviously i have replaced removed the host name since i am posting this) ...

Problems updating Access 2003 Database
We currently use an Access 2003 data base to create and send forms within the organization. We are seeing instances where the new records are not appending and believe it may be the query that is causing the issue. The INSERT query is: INSERT INTO table_headerdata ( wso_num ) SELECT Max([table_headerdata]![wso_num])+1 AS Expr1 FROM table_headerdata WHERE wso_num < 1000000; We would appreciate any help to resolve this issue. On Fri, 4 Jan 2008 16:50:00 -0800, ehess00 <ehess00@discussions.microsoft.com> wrote: >We currently use an Access 2003 data base to create and send for...

Can I use the same driver in all versions of Access or Sqlserver
Hello,I have got a question,I wonder if i can use the same driver as Access2000 to get the data from all versions of Access database,my code connected to Access2000 is as follows: "m_pConnection->Open("Provider=Microsoft.Jet.OLEDB.4.0;DataSource="+s.m_database,"","",adModeUnknown); Is this code available for other versions of Access? If not,can anyone tell me the correct code for Access2002.Access2003,Access97? my code connected to Sqlserver2000 is as follow: m_pConnection->Open(Provider=SQLOLEDB.1;Persist Security Info=True;Password="+s.m_pass...

how to repeat print single tile of multiple tile poster?
in publisher one tile of multiple tile poster failed to print (ran out of ink). how do I print only the tile that missing? Other than complete (20 sheet) print run. There is no easy way of doing this. Take a look at print preview to determine what tile you need to print. Create rectangles around the areas you don't want to print, fill with white, no line. Keep checking print preview to be sure you are covering the correct tiles. You will end up printing 20 pages, but only one will use ink. -- Mary Sauer http://msauer.mvps.org/ "billyb." <billyb.@discus...

change business card printing from 10 to 8 on a page?
Some how Pub reverts back to a 10 per page even when I org set it up a 8 per page how do I change it back to 8 What version Publisher are you using? 2003 and below, Page setup, Business cards, click *Change copies per page*... Type: ..5 side ..75 top ..5 Horizontal Gap ..5 Vertical Gap This setup will print with crop marks, if you don't want the marks, on the print screen click *Advanced Print Settings* 2007, File, Page setup, Advanced (on the right) select *Multiple pages per sheet*, change the margins to those above. Give the setup a name, it will be available next time you nee...