I have a subform that I do not want to load if the main form doesn't load. I'm using the coding below but get an error message saying "Compile error: Statement invalid outside Type block" and points to the line FinishedLoading As Boolean on the main form. I may just be a little bit off or maybe there might be a better method to accomplish this?
Coding on Main Form:
Private Sub Form_Load()
FinishedLoading As Boolean
Forms![Vendor Reporting Navigation].Visible = False
Dim pwd As String
pwd = InputBox("Enter Password?")
If pwd = "ABC123" Then
MsgBox "Password Accepted"
Else
MsgBox "Incorrect Password"
DoCmd.Close
End If
FinishedLoading = True
End Sub
Coding on SubForm:
Private Sub Form_Close()
If Not Forms("Maintenance Reports List").FinishedLoading Then
Exit Sub
End If
On Error Resume Next
DoCmd.RunMacro "Update Due Dates"
DoCmd.OpenForm "Duplicates for Master Report Tracking 2", acNormal
End Sub