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!

check for a blank table.

Status
Not open for further replies.

Leslie67

Programmer
Jul 23, 2002
42
US
I have a table that I need to split out to different reports based on a name field. This works fine and I end up with 7 different tables.

I run a Report based on each of these tables and I have some VB code running in the back of the report to make titles visible and not visible.

My problem comes when one of the tables that has been split out has no records in it. (This is normal - or at least, not unusual.) The VB code stops the program running when it hits the table with no records in it.

What I need is *either* a way to force a blank line into the blank table, or the VB or SQL code to check for a blank table before attempting to run the code.

Clear as mud? Can anybody help me?

Thanks
 

If DCount ("*", "Tablename") > 0 Then
' Trigger your report here
Else
MsgBox "Table has no records", vbOkOnly+vbInformation
End If

John
 
John:

That was it exactly!!

I've put the code onto the form, put in the verbage to customize it and it's working just as I want it to.

Thank you so much! I really appreciate it.

Leslie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top