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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Testing for an empty recordsource

Status
Not open for further replies.

PeteG

Programmer
Feb 23, 2001
144
GB
Hi, I have a form that is bound to a recordsource - a table. I want to be able to test whether any data will be displayed on the form so that I can make it do something different, ie if there is no data in the table then I'll make all the controls invisible except for a label saying 'no data' or something like that.

So, I want to put a test in the 'on open' event to do this. I know that I could open a recordset on the same source as the form to find the row count or run sql to get the same...but is there an even simpler way of just testing the recordsource to see if it is empty?

Thanks for any help.
 

How about a dlookup? Something like...
Code:
If IsNull(Dlookup("KeyField","TableName")) Then

Randy
 
Thanks to you both, just what I was looking for.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top