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
1678 Views

Similar Articles

[PageSpeed] 3

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:

Outlook shutting down when accessing moved mailboxes
We recently built a new Wxchange 2003 Server in one of our offices and have been moving mailboxes to the new server. Now some of the users that were moved say that Outlook is shutting down when they try to do different things - for one person, it happens when she opens her Calendar, for another, it's when he opens mail items. I'm re-creating their mail profiles, but I know that the first thing I try almost never works, so I thought I'd send this question along to see if anyone has suggestions fror other steps I can try to remedy these issues. Thanks in advance! I had so...

In Excel I need to insert a clean form each use
I have created a protected worksheet with unlocked cells to be filled in by the user and saved. Then next week I need to to have another copy of the same blank form for the user to fill in with new data. I thought I could just insert a copy of the form (as its own file) on Sheet 1, but can't figure out how to do that. Robin, Hold down the CTRL key, left click the sheet tab and drag to create a copy. It will have a name of something like Sheet1 (2) so rename as required. Mike "Robin" wrote: > I have created a protected worksheet with unlocked cells to ...

Disabling Preview Pane in Outlook 2000
Is it possible? Thanks. Guessing you mean how can you get rid of the preview pane so you can only double click on messages to view. Then Yes, it is possible. 2 ways 1. Make sure you're in the folder that you want the preview pane gone from (ie. Inbox Right click on the message header (The part in grey telling you From: To: Subject: and CC: Left click on Preview pane It should then disappear 2. Make sure you're in the folder that you want the preview pane gone from (ie. Inbox Left click on View (On the main menu bar Then left click Preview Pane Again it should disappear Hope this he...

Double Click Open Form Filtered
I need to be able to create a button (or a double click function) to open a main form and filter it to show only the main form records with the subform records matching a particular ID #. Main form: FRM_Tickets-Active (pulls data from the table "TBL_Tickets" (filtered by a query to show only active tickets) Sub form: SUB_EXP_Tickets (pulls data from the table "TBL_Expenses" (linked to the main form by the field "WorkOrderNum" Field in subform to filter on: VendorID Can anyone help me figure out how to do this? All you really need to do is use the Link Master Fi...

Lost access to Delegates tab
Exchange 2003 SP2 organization, running in mixed mode. Most users cannot access Delegates tab; trying to do so results in message: "The Delegates page is not available. Unable to access Outlook folder. The connection to the Microsoft Exchange Server is unavailable. Outlook must be online or connected to complete this action." More info: - Recently created users do not have this problem. - Verified is not an Outlook issue; have set up multiple profiles on my computer for testing -- no older user can open Delegates, recently created users can open Delegates, all using same i...

Microsoft Access "Classroom management database" question
Microsoft Access "Classroom management database" question. When grading, it has the ability in this template to put in scores for Assigments, Quizzes, Exams, Etc. For example, student scores 45 our of 100 possible points. BUT it does not calculate that into a grade, that field is editable and I guess you have to manually put in a letter grade. Leaving room for human error. Is there a way to make the # of points work or translate into a Letter Grade. Path is: Open Classroom management database, go to classes, choose assignment tab, and click View assignements. THere you can ...

Print document (packing slip) for inventory transfer/adjustment
An option should be given to print a document (not only edit list) when a transfer or an adjustment is done. This could be in the form of a packing slip (not showing cost) or one showing the cost. This would be useful when transfering between remote sites and a transfer document can accompany the goods being transfered. This will assist staff with verifying that what was electronically transfered was what was physically transfered ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click t...

CRM 1.2 User Access Error 'The system could not log you in..
My client has CRM 1.2. After some windows updates were done to the server and possibly some reconfiguration of IIS settings, the users can no longer log in as the following message appears: User Access Error: 'The system could not log you in. This could be because : ...etc...' Even the server administrator and the crmadmin account cannot login. Is there any particular action that you helpful guys can think of that may have caused this? Many Thanks, ...

Multiple Instance of same form retrieving different data.
I have a form that shows Batch Jobs by name. Connected to this is a subform which shows unique Batch Job Name & Job Nbr combination records. The Batch Job Name and Job Nbr are the primary keys for the table being sourced by the subform. For Example, I have a form with Job Name of: Batch Job A and a sub form which Shows Batch Job A, 12 Steps & Batch Job A 16 Steps. The Job Nbr is hidden because its an internal number that ties back to source system. What I would like to do is give the user the ability click on the batch Job name in the sub form which will open form Batch...

button onclick event
Hi I have a spreadsheet with 6 worksheets, each of which has a button with corresponding onClick event code. In my final worksheet I have a button that when I click I want it to cause each of the onClick events of the other worksheets buttons to fire. Anyone any clues or sites I can view to help me do this? Thanks in advance Brendan ______________________________________________ Rate your experiences with your UK and Ireland builders at http://www.ratethebuilder.co.uk ========================================= If what I want cannot be done, is it possible to call a function in one s...

Business Cards
Can anyone tell me whether you can change the print layout of the business cards? It is such a waste of card to only print 4 cards! I would likt to be able to print 8 business cards to a page. Can this be done? And how? Thanks, What version Publisher? What is the style number of your business cards? Are they the standard 3.5 x 2? Most templates are 2 columns of five or 10 to a page. It would be helpful to know the style number so as to calculate the margins and gaps. -- Mary Sauer http://msauer.mvps.org/ "Tonijr" <Tonijr@discussions.microsoft.com> wrote in message ...

Project Web Access 2003 (SP3) and IE8
My organization will upgrade all the client desktop computer from XP (SP2) to Windows7 (64-bit) with Office 2010 (32-bit) and IE8 by the end of this year. Our group is currently using Project Server 2003 (SP3) with SQL Server 2005 (SP3). I would like to know if the current configuration of client - Project Professional 2003 and PWA 2003 (SP3) - will be compatible with the new Windows 7 environment. In the official Microsoft Windows 7 Compatibility site, Project Professional 2003 is certified as "compatible", but no information on PWA. I also concerned about PWA and IE8 ...

Excel macro to create e-mail in Outlook Web Access
Hi, Where I work they've changed from Outlook 2003 to Outlook Web Access. At the end of each day I send a report by e-mail to several other people in the organisation. To date I've used a macro in Excel that takes figures from a worksheet and creates an e-mail in Outlook. If I'm logged in to Outlook Web Access, can I still get an Excel macro to create an e-mail message? Thanks, DL ...

Financial modelling from Excel to Access
Hi there, I'm working for a manufacturing company in FMCG industry. One of m jobs is to build and maintain an activity based financial model i Excel which simulates the whole group's financial performance based o current/projected sales & manufacturing conditions. The model ca enable user to drill down to SKU level to analyse the profitability Because I don't have access to our ERP system's database, I have t replicate all master data I need in various tables in the mode workbook. That means the model has its build-in database in Exce worksheets. The model is 100% dynamic...

OnMouseOver for button on continuous form
How to make an OnMouseOver event for a button on a continuous form? 1. Is it possible? 2. Is it possible in Access 2003? 3. Can somebody give me a hint on how to do it, so that I can keep going? In Access it's called MouseMove rather than MouseOver. You can do this, of course, but exactly what are you trying to do with it? On a Continuous form, if the button's in the header or footer it's pretty straight forward, but if you have a button on each row MouseMove for one button will affect all of these buttons! This is usually used to do things like formatting colors, boldness, etc ...

Write in the spreadsheet having a form open
Hi everybody, How can I write in the spreadsheet having a form open? I can not use the ShowModal property. Thanks in advance. Lidmat -- lidmat ------------------------------------------------------------------------ lidmat's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=16658 View this thread: http://www.excelforum.com/showthread.php?threadid=319290 If the form is displayed modally, you cannot access the worksheet while the form is visible. To display the form modelessly, use Userform1.Show vbModeless -- Cordially, Chip Pearson Microsoft MVP - Excel Pea...

Access 2007 Runtime breaks Office 10
I installed Access 2007 Runtime for a test on a Win XP Pro system that has Office 10. When I tried to run my previous application (.MDB) it run under Access 2007 Runtime, instead of Office 10. So I uninstalled Access 2007 Runtime, but it then I could not run any Office 10 applications (Access, Excel, Word). I ran the Office 10 installation CD and I expected the option to "fix", but it didn't appear, even though the files existed in Program Files. I ran a full installation and Word & Excel seems to be working OK. However, when I try to open my database via a S...

Form auto-fill linking
Hi, I am very new to Access (2003) and don't have any familiarity with coding. I am trying to develop a form for entering chart information for a large number of patients. Each patient has a unique record number associated with him/her ("Patient Information" table), and one to several visits. Each visit of each patient has its own chart ID number ("Patient Visits" table), which in turn is associated with the chart information for that particular visit ("Chart Information" table). I would like to be able to enter the record number of a patient into a form and...

can a table be opened in access by todays date
Hi Can anyone point me in the right direction here, I would like to open a table in access 2003 by date. I have an asp web page which needs to read data from a table with each days today's date (which ever day that is) then a new table is created with today's date. Example: I have a table called 17-may-2007 my ASP page reads this table for 24hours then tomorrow (12:00 midnight 18th) I will have a new table called 18-may-2007 and the old table is left behind (As 17-may-2007) so I need my sql statement to automatically open table by today's date. This is what I have so far but it...

Accessing Composite Control Viewstate stored properties from clientside Javascript
I've created a composite control called GRIDLOOKUP that contains an ASP:LINKBUTTON and ASP:IMAGEBUTTON. I've also added TEXT and KEY properties to GRIDLOOKUP which store their values in GRIDLOOKUP's viewstate. GRIDLOOKUP copies its TEXT property to the LINKBUTTON's TEXT property, so that the current value of GRIDLOOKUP is displayed in the LINKBUTTON. When GRIDLOOKUP makes its round trip between the client and server, both TEXT and KEY properties are persisted properly. I've placed GRIDLOOKUP in a DataGrid Template on a webpage. When the webpage runs, the dat...

Print Ranges #2
Can you combine multiple spreadsheets so the pages print consecutively; i.e., spreadsheet 1 has 11 pages and the footer needs to read 1 of ?, 2 of ?; spreadsheet 2 has 3 pages and needs to start with 12 of ?, etc. If you are speaking of two workbooks each with one worksheet, then: In page setup of each, header/footer, custom footer, enter: Page &[Page] of 14 On second workbook, in page setup, change: First page number, from: auto to 12. Print. If you are speaking of two worksheets within one workbook, then: In page setup of each, header/footer, select: page 1 of ? or in custom foote...

Access Query Output to report Summation problems
Hello, I have a query that I output into a report. When I use the sum function in the report control source property field I get a mismatch error when I run the report. example CURRENT DOLLARS 2.00 - 3.00 - - =Sum(current_1) the "-" signifies nothing, the output is blank on the report and in the database there is no data stored there. I read that the sum function ignores null. Is there a way where I can sum the above example? Also, I cannot populate the cells with 0's because 0 is an actual value. Thanks in advance Is it possible that current_1 is NOT numerical (but te...

Custom form causes Dr Watson
I have one machine that does not like a custom form. The form will cause a dr watson error when it does the Check Name. I have banged my head on this for quite some time, and have even rebuilt the machine (OS) from the ground up. Something specific to that is causing this error (Suspicions include Adobe products, they don't tend to play well with others). I have retrieved the Dr. Watson log, but it does not appear to be much help. Any suggestions are greatly appreciated! Thanks, Nick ...

More printing issues...deeper issue?
Version: v.X Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel First off, thank you to Bob for continuing to help me with this issue. <br><br>Here's the latest issue: <br><br>I went through the process described earlier - opening the &quot;corrupt&quot; document in TextEdit and copying the text into a new document. It prints just fine. I've also created new &quot;stationary&quot; (i.e., a header with my contact info) which prints just fine. However, when I paste the old text in the new stationary...it won't print! I&...

shortcut to open form
Hi everybody, Ive created a form called outofhours.oft which enables people to let the estates department know when they would like to work late. I would like to create a shortcut to go in the start menu that will open this form (called outofhours.oft, ive not published the form yet). Is such a thing possible? i can do a similar thing using mailto:outofhours?subject=outofhoursrequest but that will just open a standard email however i need to make sure the correct data is collected. As people are rather computer illiterate here i need something that is ID10T error proof ;) Somebody cou...