Do not open with no records

B

Bill Neilsen

I have set up a Task reminder form in my application that I want to open when
I start the database. However, if there are no tasks (Records) how do I stop
it from opening.
 
A

Allen Browne

Cancel the Open event of the form if there are no records:

Private Sub Form_Open(Cancel As Integer)
If Me.RecordsetClone.RecordCount = 0 Then
Cancel = True
End If
End Sub
 
B

Bill Neilsen

Thanks Allen, I have copied a few of the tips on your web site. This one
worked a treat. Much appreciated from a fellow Perth boy.
 
Top