Solved

MS access report  limit to 25 records

Posted on 2013-11-25
7
383 Views
Last Modified: 2013-12-05
Of course I'm doing something wrong

Private Sub Report_Open(Cancel As Integer)
  
Dim TotalRec1 As Long

TotalRec1 = DCount("OfferDetailID", "Offer Details", "OfferDetailID" = "(-1)/25")

End Sub

Open in new window

0
Comment
Question by:mvdwal
  • 4
  • 3
7 Comments
 
LVL 34

Expert Comment

by:PatHartman
ID: 39675693
To limit the records selected, use a query.  The TOP predicate will limit the results to the Top n records.  N is not a variable though.  It is hard-coded in the query and you can't change it at runtime.  If you need n to be variable, you need to build the SQL string on the fly rather than using a querydef.

Right click on the gray background in the QBE to open the properties window.
TopValues.JPG
0
 

Author Comment

by:mvdwal
ID: 39675732
Dear Pat Hartman, Thanks for helping me out.

I use images in a report. If there are more than 30 or 35, then the images in the report empty. That's why I like: one report for the firts 25 records, another report for the next 25 records 25 to 50.
0
 
LVL 34

Expert Comment

by:PatHartman
ID: 39675968
Didn't I just see an answer to this problem?  Do you have another thread going?  I believe the answer involved a code loop and getting 25 images at a time.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:mvdwal
ID: 39676037
No no answer yet
0
 
LVL 34

Expert Comment

by:PatHartman
ID: 39676172
So, you have another thread going?
0
 

Accepted Solution

by:
mvdwal earned 0 total points
ID: 39676697
Yes I have another thread going. But no solution yet.
here's the thread
0
 

Author Closing Comment

by:mvdwal
ID: 39697810
The solution is in the other thread
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now