473,410 Members | 1,946 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,410 software developers and data experts.

Show only a given number of places on a report

489 256MB
In the data that feeds the report there are standings 1,2,3,4 etc. These standing can go from 1 to 100 or more. And these can be divided into categories. I want to give the user the option to on show a certain number of places for each category.
In the report Open I prompt the user for the number of places they want to show.
I then count the number of records in the Detail_Print
In the Detail_Format I check the number of records and when I reach the Places the user entered I set Cancel = true, But it doesn't stop if continues printing.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
  2.     If VPlaces <> 0 Then
  3.         If Me.txtcount > VPlaces Then
  4.             Cancel = True
  5.         End If
  6.     End If
  7. End Sub
  8. Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
  9.     txtcount = txtcount + 1
  10. End Sub
  11. Private Sub Report_Open(Cancel As Integer)
  12.    stdmsg = "Show how many places. Enter 0 for complete list"
  13.    VPlaces = InputBox(stdmsg, , 10)
  14.  
  15. End Sub
Can someone show me what I'm doing wrong.

Thanks
Apr 1 '19 #1
3 938
NeoPa
32,556 Expert Mod 16PB
Hi Tom.

Setting Cancel = True in the _Format event procedure simply cancels the formatting. If you want to cancel the printing then you need to set it in the _Print event.

What your logic is trying to do is unclear as most of your variables aren't declared in what you show. There is also nothing to indicate you've considered or handled grouping within your categories or that you've taken PrintCount into consideration.
Apr 1 '19 #2
twinnyfo
3,653 Expert Mod 2GB
Tom,

This also begs the question as to why you are determining the number of places at the time you are generating your report. Why not get the number of places first, and then use that value to filter your report appropriately? Unless I am missing something fundamental (which is possible, as your description is a bit unclear), this may be a very simple solution to your problem.
Apr 1 '19 #3
NeoPa
32,556 Expert Mod 16PB
I suspect the complication comes from the fact that X number of items per category are required. That's much harder to do in SQL.
Apr 1 '19 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Greg Reed | last post by:
I have a 4 column report and wondered if there is column number property. I have more complicated uses for it but basically could I Have column number shown at ctop of each column 1 ...
13
by: Kishor | last post by:
Hi Friends Please help me to write a C program to find the 5th (fifth) root of a given number. Ex:(1) Input : 32 Output : 5th root of 32 is 2 Ex:(1) Input : 243 Output : 5th root of 243 is...
2
by: Reddy | last post by:
Hi, How to check whether a given number is an integer Thanks, Reddy
11
by: gchiazx | last post by:
Hi, can someone send me the algorithm for finding the products of prime numbers from a given number? Thank You Gary.
17
by: scan87 | last post by:
Can somone please, please give me the solution for the following problem. I need to submit it on Monday. Write a global function called format, which formats numbers with a given number of decimal...
1
by: psbasha | last post by:
Hi, How to find the number of digits from a given number?. For example num = 23456 The number of digits are 5 num = 2311150
4
by: gaurav1983 | last post by:
i have to generate unique combinations of given number of digits entered by user eg: N=4 (0,1,2,3) output should be 0 1 2 3
2
by: Ricky71 | last post by:
I'm writing a program in vb.net 2008 that calculates grades and puts them in a list. When I use Math.Round it will not show two decimal places for a number without decimals. For example: This is...
15
by: shivpratap | last post by:
I m solving a problem to find the sum of divisors of a given number(the number is a large one),...i hv written the code bt it's exceding the time limit...hw can i reduce the time in such cases...pls...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.