Voltron
Defender of the universe
- Local time
- Today, 14:49
- Joined
- Jul 9, 2009
- Messages
- 77
I want to make it so that the user has to hit my close form button in order to close the form. This is the code that I found. This works perfectly, except I am unable to close the form because I get the following error...
Compile Error: Label Not Defined
It then highlightes the line Private Sub btn_Close_Click() in yellow and puts the focus on the next line.
What am I doing wrong?
Public AllowClose As Boolean
Private Sub Form_Load()
AllowClose = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
Cancel = Not AllowClose
End Sub
Private Sub btn_Close_Click()
On Error GoTo Err_btn_Close_Click
AllowClose = True
DoCmd.Close
Exit_btn_Close_Click:
Exit Sub
Err_cmdClose_Click:
MsgBox Err.Description
Resume Exit_btn_Close_Click
End Sub
Compile Error: Label Not Defined
It then highlightes the line Private Sub btn_Close_Click() in yellow and puts the focus on the next line.
What am I doing wrong?
Public AllowClose As Boolean
Private Sub Form_Load()
AllowClose = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
Cancel = Not AllowClose
End Sub
Private Sub btn_Close_Click()
On Error GoTo Err_btn_Close_Click
AllowClose = True
DoCmd.Close
Exit_btn_Close_Click:
Exit Sub
Err_cmdClose_Click:
MsgBox Err.Description
Resume Exit_btn_Close_Click
End Sub