no data for report (1 Viewer)

deekras

Registered User.
Local time
Today, 12:09
Joined
Jun 14, 2000
Messages
169
i have to make a report that will list only those transactions >= [begindate] AND <=[enddate]. I also have to include a running balance only for those transactions.

So i wrote this coding for the OnFormat of the Detail section of the report:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If [transaction date] >= [Forms]![Select Dates]!begindate And [transaction date] <= [Forms]![Select Dates]!enddate Then
Detail.Visible = True
Else
Detail.Visible = False
End If
End Sub

It works fine.

My question is: i am only hiding that data; it is actually there on the report. However, i want to send a message & then close the report if there are no transactions during the specified dates.

I put a message & cancel = true on the nodata, but there is data so it opens the report, with the header, etc. but i don't want it to open at all!

i suppose i could write coding on the onopen that will check if there is any data for the dates specified, i just can't figure out what to write.

any suggestions? Thanks
 

DALeffler

Registered Perpetrator
Local time
Today, 05:09
Joined
Dec 5, 2000
Messages
263
You might try to limit the record source for the report by the begining & ending dates from the user to begin with. I wouldn't think a report source should be asking for (and getting) records that aren't going to be displayed.

Then the no data event will work just fine.

Or am I completely missing the boat?

Doug.

[This message has been edited by DALeffler (edited 02-20-2001).]
 

Chris RR

Registered User.
Local time
Today, 06:09
Joined
Mar 2, 2000
Messages
354
I agree with Doug.

First, I'd create a query that uses the beginning and ending dates as its criteria, then I'd use that query as the source for the report.
 

deekras

Registered User.
Local time
Today, 12:09
Joined
Jun 14, 2000
Messages
169
i know i could do that. but i also need a running balance starting from whatever point the report begins.

for example. if the reports asks for the 20th transaction - 30th , i need a running balance starting from the 20th transaction.

since i am not saving balances at each transaction, how would i present that data? so i figured i could hide the transactions before so that it is keeping a running balance and only show the section of the entire report that i need.

does that make sense?
 
R

Rich

Guest
Create a second query based on the first in the criteria put<[Forms]![Select Dates]!begindate .
Add a text box to the report header set control source to =DLookup("yourqryname","thecontrolname) add the result of that to your running sum field.
HTH
 

deekras

Registered User.
Local time
Today, 12:09
Joined
Jun 14, 2000
Messages
169
confused. can you explain that better? where would i put that coding?

i need the running balance to start from the balance of specified date and end at a certain date. (all transactions from 3/1/00 until 5/1/00) although there may be balances from before and continue thereafter.
 

Users who are viewing this thread

Top Bottom