A
Afrosheen via AccessMonster.com
Thanks for reading this.
I have a form were if there are no records it is supposed to display a
message stating there are no records then close the form. The problem is that
it does display the message, but it doesn't close the form. The form will
still display but will be blank because of empty records. I've tried docmd.
close,"name of the form". It still displays the form. I've even tried "On
Load" and "On Currant" Am I doing something wrong?
Here the code:
Private Sub Form_Open(Cancel As Integer)
10 On Error GoTo Form_Open_Error
50 If Me.RecordsetClone.RecordCount <> 0 Then
60 Exit Sub
70 Else
80 Call MsgBox("There are no records on file at this time.",
vbInformation, Application.Name)
90 DoCmd.Close
100 End If
110 On Error GoTo 0
120 Exit Sub
Form_Open_Error:
130 Err.Description = Err.Description & " In Procedure " & "Form_Load
of VBA Document Form_frmEmployeeArchive"
140 Call LogError(Err.Number, Err.Description, "Form_Open")
End Sub
I have a form were if there are no records it is supposed to display a
message stating there are no records then close the form. The problem is that
it does display the message, but it doesn't close the form. The form will
still display but will be blank because of empty records. I've tried docmd.
close,"name of the form". It still displays the form. I've even tried "On
Load" and "On Currant" Am I doing something wrong?
Here the code:
Private Sub Form_Open(Cancel As Integer)
10 On Error GoTo Form_Open_Error
50 If Me.RecordsetClone.RecordCount <> 0 Then
60 Exit Sub
70 Else
80 Call MsgBox("There are no records on file at this time.",
vbInformation, Application.Name)
90 DoCmd.Close
100 End If
110 On Error GoTo 0
120 Exit Sub
Form_Open_Error:
130 Err.Description = Err.Description & " In Procedure " & "Form_Load
of VBA Document Form_frmEmployeeArchive"
140 Call LogError(Err.Number, Err.Description, "Form_Open")
End Sub