473,566 Members | 3,245 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Show only a given number of places on a report

489 Contributor
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 942
NeoPa
32,564 Recognized Expert Moderator MVP
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 Recognized Expert Moderator Specialist
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,564 Recognized Expert Moderator MVP
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
1704
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 2 3 4 < Column Number. ABC DEF GHI JKL Did briefly try programming a counter but can't...
13
12718
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 3 Click here : www.c4swimmers.esmartguy.com to Test Your C Programming Strengths.
2
2705
by: Reddy | last post by:
Hi, How to check whether a given number is an integer Thanks, Reddy
11
46415
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
5265
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 places. The function accepts a compulsory first argument of type double (the number to be formatted) and a second optional argument of type integer...
1
2761
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
2832
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
5844
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 what I have 100 96.97 93.94 ... Is there a way to force 100 or any other number that does not have decimals to have .00 after it?
15
20585
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 help me....i m a beginner 2 programming in c :) Hre is my code: #include<stdio.h> int main() { long long int k,n,t,sum=0; ...
0
8109
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7645
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7953
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6263
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5485
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3643
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2085
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1202
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
926
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.