Prev: combo box troubles
Next: Double Metal Jacketed Gasket
From: Stewart Berman on 4 Jun 2010 18:30 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?
From: Jeanette Cunningham on 5 Jun 2010 18:55 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(a)nospam.nospam> wrote in message news:1kvi0655kbngmk6jdqoo0i88l00vpvjooh(a)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? >
From: Stewart Berman on 6 Jun 2010 18:57 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(a)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(a)nospam.nospam> wrote in message >news:1kvi0655kbngmk6jdqoo0i88l00vpvjooh(a)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? >> >
From: Jeanette Cunningham on 6 Jun 2010 22:15 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(a)nospam.nospam> wrote in message news:sk9o061oe3dm665mfrqjvtgfcbo4k299sh(a)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(a)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(a)nospam.nospam> wrote in message >>news:1kvi0655kbngmk6jdqoo0i88l00vpvjooh(a)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? >>> >>
|
Pages: 1 Prev: combo box troubles Next: Double Metal Jacketed Gasket |