Hi,
I am having a problem with an On Open Event Procedure. I have a main form - fMainForm1 that loads on Startup with a subform - frmHelpAbout, which is designed to display certain information and check to see if certain Tables are present. If the Tables are present, after a short time delay a MsgBox appears to load the Log In SubForm, and everything is working OK if the various Tables are found. If a Table is not found, a MsgBox appears warning the table data is not found. When click OK, supposed to Quit the application. However, what happens if a Table is not found is the MsgBox appears but when click OK, get another MsgBox with error stating Quit is not available with End or Debug. If click End, then fMainForm1 loads without frmHelpAbout. If click Debug, goes into VB Debug with the DoCmd.Quit highlighted. Below is the On Open Event Procedure coding for the subform I am using. Hope someone can help me figure out why it will not Quit. Thanks!
****Coding****
Private Sub Form_Open(Cancel As Integer)
On Error GoTo CloseProgramAndExit
DoCmd.Maximize
Forms!fMainForm1.Caption = "About Program & Verification"
Me.lblVerifyingDataFiles.Caption = "Checking Tables . . ."
' Check ConfigTable
If Not TableExists("ConfigTable") Then
MsgBox "Database will close. Contact Programmers.", vbCritical & vbOKOnly, "COMPANY CONFIGURATION NOT FOUND!"
GoTo CloseProgramAndExit
End If
' Check LicenseTable
If Not TableExists("LicenseTable") Then
MsgBox "Database will close. Contact Programmers.", vbCritical & vbOKOnly, "LICENSE NOT FOUND!"
GoTo CloseProgramAndExit
End If
' Check Administrator Log In Table
If Not TableExists("tblLogInAdmin") Then
MsgBox "Database will close. Contact Programmers.", vbCritical & vbOKOnly, "ADMINISTRATOR DATA NOT FOUND!"
GoTo CloseProgramAndExit
End If
' Check Employees/Users Log In Table
If Not TableExists("tblEmployees") Then
MsgBox "Database will close. Contact Programmers.", vbCritical & vbOKOnly, "EMPLOYEES/USERS DATA NOT FOUND!"
GoTo CloseProgramAndExit
End If
' Check Date Table
If Not TableExists("DateTable") Then
MsgBox "Database will close. Contact Programmers.", vbCritical & vbOKOnly, "DATE DATA NOT FOUND!"
GoTo CloseProgramAndExit
End If
' Check Month Table
If Not TableExists("MonthTable") Then
MsgBox "Database will close. Contact Programmers.", vbCritical & vbOKOnly, "MONTH DATA NOT FOUND!"
GoTo CloseProgramAndExit
End If
' Check Form Usage Log Table
If Not TableExists("tblLogDoc") Then
MsgBox "Database will close. Contact Programmers.", vbCritical & vbOKOnly, "FORM USAGE DATA NOT FOUND!"
GoTo CloseProgramAndExit
End If
' Check Legal Practice Table
If Not TableExists("LegalPracticeTable") Then
MsgBox "Database will close. Contact Programmers.", vbCritical & vbOKOnly, "LEGAL PRACTICE DATA NOT FOUND!"
GoTo CloseProgramAndExit
End If
Exit_and_End:
Exit Sub
CloseProgramAndExit:
DoCmd.Quit
End Sub
I am having a problem with an On Open Event Procedure. I have a main form - fMainForm1 that loads on Startup with a subform - frmHelpAbout, which is designed to display certain information and check to see if certain Tables are present. If the Tables are present, after a short time delay a MsgBox appears to load the Log In SubForm, and everything is working OK if the various Tables are found. If a Table is not found, a MsgBox appears warning the table data is not found. When click OK, supposed to Quit the application. However, what happens if a Table is not found is the MsgBox appears but when click OK, get another MsgBox with error stating Quit is not available with End or Debug. If click End, then fMainForm1 loads without frmHelpAbout. If click Debug, goes into VB Debug with the DoCmd.Quit highlighted. Below is the On Open Event Procedure coding for the subform I am using. Hope someone can help me figure out why it will not Quit. Thanks!
****Coding****
Private Sub Form_Open(Cancel As Integer)
On Error GoTo CloseProgramAndExit
DoCmd.Maximize
Forms!fMainForm1.Caption = "About Program & Verification"
Me.lblVerifyingDataFiles.Caption = "Checking Tables . . ."
' Check ConfigTable
If Not TableExists("ConfigTable") Then
MsgBox "Database will close. Contact Programmers.", vbCritical & vbOKOnly, "COMPANY CONFIGURATION NOT FOUND!"
GoTo CloseProgramAndExit
End If
' Check LicenseTable
If Not TableExists("LicenseTable") Then
MsgBox "Database will close. Contact Programmers.", vbCritical & vbOKOnly, "LICENSE NOT FOUND!"
GoTo CloseProgramAndExit
End If
' Check Administrator Log In Table
If Not TableExists("tblLogInAdmin") Then
MsgBox "Database will close. Contact Programmers.", vbCritical & vbOKOnly, "ADMINISTRATOR DATA NOT FOUND!"
GoTo CloseProgramAndExit
End If
' Check Employees/Users Log In Table
If Not TableExists("tblEmployees") Then
MsgBox "Database will close. Contact Programmers.", vbCritical & vbOKOnly, "EMPLOYEES/USERS DATA NOT FOUND!"
GoTo CloseProgramAndExit
End If
' Check Date Table
If Not TableExists("DateTable") Then
MsgBox "Database will close. Contact Programmers.", vbCritical & vbOKOnly, "DATE DATA NOT FOUND!"
GoTo CloseProgramAndExit
End If
' Check Month Table
If Not TableExists("MonthTable") Then
MsgBox "Database will close. Contact Programmers.", vbCritical & vbOKOnly, "MONTH DATA NOT FOUND!"
GoTo CloseProgramAndExit
End If
' Check Form Usage Log Table
If Not TableExists("tblLogDoc") Then
MsgBox "Database will close. Contact Programmers.", vbCritical & vbOKOnly, "FORM USAGE DATA NOT FOUND!"
GoTo CloseProgramAndExit
End If
' Check Legal Practice Table
If Not TableExists("LegalPracticeTable") Then
MsgBox "Database will close. Contact Programmers.", vbCritical & vbOKOnly, "LEGAL PRACTICE DATA NOT FOUND!"
GoTo CloseProgramAndExit
End If
Exit_and_End:
Exit Sub
CloseProgramAndExit:
DoCmd.Quit
End Sub