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

Problem with displaying data in report when report details has no data

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi..
I have problem to display data in report because the details has no data. In report header, i want to display [Annual],[BForward],[Total] and [Balance]. In report details, i want to display [StartDate],[EndDate],[Subtotal].
Let say, A takes leave from 2/5/2002 - 3/5/2002 and from 12/6/2002 - 14/6/2002.
|--------------------Report header-------------------------|
[Annual]|[BForward]|[Total]|[Balance]
20 2 5 17
|------------------Report details--------------------------|
[StartDate]|[EndDate ]|[Subtotal]
2/5/2002 3/5/2002 2
12/6/2002 14/6/2002 3
|-----------------------------------------------------|
[Total] = Sum([Subtotal])
[Balance] = [Annual]+[BForward]-[Total]

Let say, B didn't take any leave.. the report should display [Annual],[BForward],[Total] and [Balance]..without details..it's mean..[Total] will be 0 value. But, my problem is, the report display nothing.

Anybody knows how to solve this problem. I've try several method..but it doesn't work..please help me..

Thanx in advance.
 
I've just had to handle a similar situation. Perhaps the method I found can apply to your situation.

Assuming that you're writing VBA code in the Event handler behind the report or form, you can apply the "RecordCount" method to determine if your recordset is empty. If there are NO RECORDS that satisfy your query criteria, RecordCount will be "0". So, if "rst" is the recordset you've opened:

If rst.RecordCount = 0, then... else... endif

Then, in your code, set the field values to "0" (or "null" or "" to get the output you want), then pass them to the form or report. (You can even do this before you generate the report and, if the recordset is empty, don't print the report at all.)

Hope this helps.
Rodger Fields
Rodger Fields
Software Engineer
Pflugerville, Texas (suburb of Austin)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top