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

check if database table has no records

Status
Not open for further replies.

Delboy14

Programmer
Jun 21, 2001
213
GB
Crystal 8.5, Access 2002

I would like to check if a table in my database has any records, from within a formula. Does anyone know how to do this? thank you in advance

e.g.
Code:
if {exTable} hasNoRecords Then
     do nothing
else 
     do something
 
You can't check a table from a formula.
You can create a subreport and (within limits) use the resulst to control things in the main report. Ken Hamady, On-site/Phone Crystal Reports Training/Consulting
Quick Reference Guide to using Crystal in VB
 
Ken, (or anyone else)
is there not a way to return the number of records in a table, I thought I had heard that? (maybe not). If I could get this, I would be able to check if this number is >0. Dou you know if/how to do this, thanks Derek
 
Try a formula like

IF COUNT(tablename.FIELDNAME) > 0
THEN Do This
ELSE Do That

Depends on where you put the formula and what you are trying to achieve
 
You can do this if your report selects that entire table as its result set. You only get one result set per report. Ken Hamady, On-site/Phone Crystal Reports Training/Consulting
Quick Reference Guide to using Crystal in VB
 
ok thanks, I cant do that, I will try to alter my database instead
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top