By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,826 Members | 2,443 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,826 IT Pros & Developers. It's quick & easy.

access 97, don't close access if form's unload event is cancelled

P: n/a
I've got application A, with a hidden form, whose unload event is
cancelled unless you use an 'exit' button (so I can do special
processing)

this works fine when using just application A and it prevents me from
'x'ing out of msaccess.exe
now, I open application A from within application B using the code
below
where function editQuote() is found within application A and to provide
application synchronization, it
opens the hidden form mentioned above
waits for it to become invisible, by using the 'exit' button,
after special processing
closes the form

and only then do I get to label 'xx'

now, if I 'X' out of the msaccess application (A), it triggers the
unload event (per my STOP statement) - but is also gets to label 'xx',
with the application A session still open

then I step through the application A unload event which is properly
cancelled but it's too late
and these lines fail
objAccess.Quit acQuitSaveNone
Set objAccess = Nothing

and I have two access applications running
and I can only kill application A using the task manager
what should happen is
start application B
hit button to start application A, suspending application B until
we 'exit' from application A
resume application B

but if I 'x' out of the application A msaccess.exe, I now have 2 copies
of msaccess running and I can access them both - how can I achieve
'what should happen' ?
Set objAccess = New Access.Application
DoEvents
With objAccess
.RefreshTitleBar
.Visible = False
.OpenCurrentDatabase applicationPath & "\" & strConfig
DoEvents
On Error Resume Next
.RunCommand acCmdAppRestore
DoEvents
.Run "editQuote", CStr(strProductId), CLng(lngQuoteId),
CStr(strSuffix), blnView
xx:
On Error GoTo fErr
End With

configure = True
fExit:
On Error Resume Next
objAccess.Quit acQuitSaveNone
Set objAccess = Nothing
Exit Function

Nov 23 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
the easiest way to avoid the problem might be to disable the "X" button in
software's title bar, so the user has no choice but the use the custom Exit
button you provide. i use the code found at
http://support.microsoft.com/?id=258049 in my A97 app, and it works great.

hth
<le*********@natpro.comwrote in message
news:11**********************@45g2000cws.googlegro ups.com...
I've got application A, with a hidden form, whose unload event is
cancelled unless you use an 'exit' button (so I can do special
processing)

this works fine when using just application A and it prevents me from
'x'ing out of msaccess.exe
now, I open application A from within application B using the code
below
where function editQuote() is found within application A and to provide
application synchronization, it
opens the hidden form mentioned above
waits for it to become invisible, by using the 'exit' button,
after special processing
closes the form

and only then do I get to label 'xx'

now, if I 'X' out of the msaccess application (A), it triggers the
unload event (per my STOP statement) - but is also gets to label 'xx',
with the application A session still open

then I step through the application A unload event which is properly
cancelled but it's too late
and these lines fail
objAccess.Quit acQuitSaveNone
Set objAccess = Nothing

and I have two access applications running
and I can only kill application A using the task manager
what should happen is
start application B
hit button to start application A, suspending application B until
we 'exit' from application A
resume application B

but if I 'x' out of the application A msaccess.exe, I now have 2 copies
of msaccess running and I can access them both - how can I achieve
'what should happen' ?
Set objAccess = New Access.Application
DoEvents
With objAccess
.RefreshTitleBar
.Visible = False
.OpenCurrentDatabase applicationPath & "\" & strConfig
DoEvents
On Error Resume Next
.RunCommand acCmdAppRestore
DoEvents
.Run "editQuote", CStr(strProductId), CLng(lngQuoteId),
CStr(strSuffix), blnView
xx:
On Error GoTo fErr
End With

configure = True
fExit:
On Error Resume Next
objAccess.Quit acQuitSaveNone
Set objAccess = Nothing
Exit Function

Nov 24 '06 #2

P: n/a
thanks

tina wrote:
the easiest way to avoid the problem might be to disable the "X" button in
software's title bar, so the user has no choice but the use the custom Exit
button you provide. i use the code found at
http://support.microsoft.com/?id=258049 in my A97 app, and it works great.

hth
<le*********@natpro.comwrote in message
news:11**********************@45g2000cws.googlegro ups.com...
I've got application A, with a hidden form, whose unload event is
cancelled unless you use an 'exit' button (so I can do special
processing)

this works fine when using just application A and it prevents me from
'x'ing out of msaccess.exe
now, I open application A from within application B using the code
below
where function editQuote() is found within application A and to provide
application synchronization, it
opens the hidden form mentioned above
waits for it to become invisible, by using the 'exit' button,
after special processing
closes the form

and only then do I get to label 'xx'

now, if I 'X' out of the msaccess application (A), it triggers the
unload event (per my STOP statement) - but is also gets to label 'xx',
with the application A session still open

then I step through the application A unload event which is properly
cancelled but it's too late
and these lines fail
objAccess.Quit acQuitSaveNone
Set objAccess = Nothing

and I have two access applications running
and I can only kill application A using the task manager
what should happen is
start application B
hit button to start application A, suspending application B until
we 'exit' from application A
resume application B

but if I 'x' out of the application A msaccess.exe, I now have 2 copies
of msaccess running and I can access them both - how can I achieve
'what should happen' ?
Set objAccess = New Access.Application
DoEvents
With objAccess
.RefreshTitleBar
.Visible = False
.OpenCurrentDatabase applicationPath & "\" & strConfig
DoEvents
On Error Resume Next
.RunCommand acCmdAppRestore
DoEvents
.Run "editQuote", CStr(strProductId), CLng(lngQuoteId),
CStr(strSuffix), blnView
xx:
On Error GoTo fErr
End With

configure = True
fExit:
On Error Resume Next
objAccess.Quit acQuitSaveNone
Set objAccess = Nothing
Exit Function
Nov 25 '06 #3

P: n/a
you're welcome :)
<le*********@natpro.comwrote in message
news:11*********************@l39g2000cwd.googlegro ups.com...
thanks

tina wrote:
the easiest way to avoid the problem might be to disable the "X" button
in
software's title bar, so the user has no choice but the use the custom
Exit
button you provide. i use the code found at
http://support.microsoft.com/?id=258049 in my A97 app, and it works
great.

hth
<le*********@natpro.comwrote in message
news:11**********************@45g2000cws.googlegro ups.com...
I've got application A, with a hidden form, whose unload event is
cancelled unless you use an 'exit' button (so I can do special
processing)
>
this works fine when using just application A and it prevents me from
'x'ing out of msaccess.exe
>
>
now, I open application A from within application B using the code
below
where function editQuote() is found within application A and to
provide
application synchronization, it
opens the hidden form mentioned above
waits for it to become invisible, by using the 'exit' button,
after special processing
closes the form
>
and only then do I get to label 'xx'
>
now, if I 'X' out of the msaccess application (A), it triggers the
unload event (per my STOP statement) - but is also gets to label 'xx',
with the application A session still open
>
then I step through the application A unload event which is properly
cancelled but it's too late
and these lines fail
objAccess.Quit acQuitSaveNone
Set objAccess = Nothing
>
and I have two access applications running
and I can only kill application A using the task manager
>
>
what should happen is
start application B
hit button to start application A, suspending application B until
we 'exit' from application A
resume application B
>
but if I 'x' out of the application A msaccess.exe, I now have 2
copies
of msaccess running and I can access them both - how can I achieve
'what should happen' ?
>
>
Set objAccess = New Access.Application
DoEvents
With objAccess
.RefreshTitleBar
.Visible = False
.OpenCurrentDatabase applicationPath & "\" & strConfig
DoEvents
On Error Resume Next
.RunCommand acCmdAppRestore
DoEvents
.Run "editQuote", CStr(strProductId), CLng(lngQuoteId),
CStr(strSuffix), blnView
xx:
On Error GoTo fErr
End With
>
configure = True
fExit:
On Error Resume Next
objAccess.Quit acQuitSaveNone
Set objAccess = Nothing
Exit Function
>

Nov 25 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.