Hi John,
One way is to have a form that you open in hidden mode, via an Autoexec
macro. Add code to the close event of this form. The hidden form can serve
double duty--it can be used to maintain a persistent connection to the BE
(back-end) database in a split multiuser Access application. More details
here:
Implementing a Successful Multiuser Access/JET Application
http://www.accessmvp.com/TWickerath/articles/multiuser.htm
Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
> Hi
>
[quoted text clipped - 4 lines]
>
> Regards
John - 13 May 2008 03:09 GMT
I have tried opening my required form in the Close event of the hidden form
but the result is that the required form appears only for a second and then
disappears.
Regards
> Hi John,
>
[quoted text clipped - 22 lines]
>>
>> Regards
John - 13 May 2008 03:17 GMT
OK, I am now opening my required form as Dialog and it does stay but I don't
have access to it, in that clicking on this form has no effect. Eventually I
have to crash access to get out.
> Hi John,
>
[quoted text clipped - 22 lines]
>>
>> Regards
John - 13 May 2008 03:36 GMT
If I run the below code in Unload event of hidden form then the required
form MyForm does get control and closing this form allows Access to close
but in a few moments Access crashes with prompt to send error report.
Private Sub Form_Unload(Cancel As Integer)
If MsgBox("Do you want to do this before exiting app?", vbQuestion +
vbOKCancel, "App Quiting Process") = vbOK Then
DoCmd.OpenForm "MyForm", acNormal, , , , acDialog
End If
End Sub
> Hi John,
>
[quoted text clipped - 22 lines]
>>
>> Regards
Tom Wickerath - 13 May 2008 06:57 GMT
Hi John,
I haven't tested this; it may or may not work...
Try canceling the unload event of the form if the user clicks on OK:
Private Sub Form_Unload(Cancel As Integer)
If MsgBox("Do you want to do this before exiting app?", _
vbQuestion + vbOKCancel, "App Quiting Process") = vbOK Then
Cancel = True
DoCmd.OpenForm "MyForm", acNormal, , , , acDialog
End If
End Sub
Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
> If I run the below code in Unload event of hidden form then the required
> form MyForm does get control and closing this form allows Access to close
[quoted text clipped - 6 lines]
> End If
> End Sub