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!

How to show only certain numbers of the records in a report? 2

Status
Not open for further replies.

jinglin

MIS
May 4, 2004
72
US
I have a report which shows the OrderID,PIN#, DateCreated,etc...
The report is grouped by PIN#. But I only need the report to show 3 most recent records for each grouped PIN#(based on DateCreated).
How am I going to do it?
Please advise

Thanks!
Jinglin
 
I would:
1) add a text box to the detail section of the report
Name: txtCount
Control Source: =1
Running Sum: Over Group
2) add code to the On Format event of the detail section
Cancel = Me.txtCount > 3
This assumes the correct sort order in your report.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
It's still not working the way I expected.
Any other suggestions?

Thanks!
 
Could you be a bit more specific than "still not working the way I expected"?

I took the time to carefully explain a method that has always worked for me based on your original question. The least you could do is suggest what isn't working and what you tried.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Sorry! Here's what I did by following your instructions:
I put a text box(txtCount) in the detail section of the report and set it Control Source to 1 and Running Sum to Over Group.
in the report's event On_Format, I wrote the code:
cancel=me.txtCount>3

When I ran the report, a message box pops up saying Enter Parameter. Just to ignore it, I click OK and the report will show all the records. I only need report to show 3 most recent dates records for each grouped PIN#

Hope it may help you understand my problem.

Thanks a lot!

Jinglin

 
Re-read my first reply to see if you can determine your error.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Actually, I did add code to the On Format event of the detail section. Am I wrong again?
 
I wrote "Control Source: =1"
You replied "set it Control Source to 1"
This would cause an enter parameter box.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
You're great! It worked exactly the way I wanted.
Thanks so much for your help and patience.

Jinglin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top