i want to open the form and display records, but if there is no record in the form i don't want to display form. what properties are available to recognise when a form's recordset is null?
Probably the easiest way is to do a DCount on a column in the underlying recordset.
If DCount("[mycolumn]","myTableorQuery">0 then DoCmd.OpenForm "MyForm"
Else
MsgBox "There are no records to edit!"
End If
i've tried your suggestion and although the message box appears when there is no records, the empty form still appears after you close down the message box.
Where are you inserting the code? The best place would be external to the form you want to open, if not you will have to insert an exit function command and a docmd.close command to both exit the code and close the form.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.