Problem with isnull

G

Guest

I'm trying to close a form if there's no underlying data in the table. My
code:

Private Sub Form_Dirty(Cancel As Integer)
If IsNull(Me.Old_Check) = True Then DoCmd.Close
End Sub

Not working - please help!!

Thanks
 
A

Allen Browne

If you want to block the form from loading when there are no records, cancel
its Open event:

Private Sub Form_Open(Cancel As Integer)
If Me.RecordsetClone.RecordCount = 0 Then
Cancel = True
MsgBox "no body home."
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top