Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

evaluating null record sets

Status
Not open for further replies.

lrmac93

Programmer
Sep 20, 2002
5
GB
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

Or something like that!

Hope this helps...T
 
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.
 
tman,
that's worked a treat. thanx for the help

lrmac93
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top