mistyinca1970
Member
- Local time
- , 20:09
- Joined
- Mar 17, 2021
- Messages
- 117
I have an AutoExec macro that opens my login form. But I want to add some error handling because I forgot to log into our VPN this morning, and I got error 2950. So I want to have a message box deploy for that error. I used the convert feature, and it created it as a Function in a module. So here's what I've come up with. Do I name the module "AutoExec"? and disable the AutoExec macro? Thank you,
Code:
Function AutoExec()
On Error GoTo AutoExec_Err
DoCmd.OpenForm "frmLogin", acNormal, "", "", , acNormal
Cleanup:
Exit Sub
AutoExec_Err:
Select Case Err.Number
Case 2950
MsgBox "You must be connected to the Network on the County VPN to open Contrax™!", vbOKOnly, "Not Connected to Network"
Case Else
MsgBox "There is a problem opening Contrax™. Please contact the administrator.", vbOKOnly, "Contrax™ Not Available"
End Select
Resume Cleanup
End Function