473,795 Members | 2,667 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to skip empty pages in a report!!

2 New Member
Hi all,
I will briefly tell you about the structure of my databse, and then will ask you my question.
I have a database for project tracking, with a table for projects, and some other tables related to the projects table (i.e. Milestones)

I have a report based on a query that selects all the projects that I have and the report is grouped by the project ID. Within this report, I have a subreport for Milestones. the query for the Milestones subreport selects all the project milestones where the project ID = the "Report" ProjectID. This makes the Milestones subreport pick only the milestones for each project ID as per the grouping done in my parent report.

The Problem:
Some projects have no milestones!
I end up having a page in the report where on the top of the page, there is the project name and nothing below it. So of course this doesn't look very presentable.

The Question:
Is there a way using VB or access to completely skip such pages from the repot so I would end up with a report for all projects that actually have milestones?

Thanks for your help!

Wael
Nov 23 '06 #1
4 3755
NeoPa
32,579 Recognized Expert Moderator MVP
Try setting some code in the OnFormat event of your page header.
You'll have to play around (experiment) to find out exactly what you need to do.
Format Event — Event Procedures


To create an event procedure that runs when the Format event occurs, set the OnFormat property to [Event Procedure], and click the Build button .

Syntax

Private Sub sectionname_For mat(Cancel As Integer, FormatCount As Integer)

The Format event procedure has the following arguments.

Argument Description
sectionname The name of the report section whose Format event procedure you want to run.
Cancel The setting determines if the formatting of the section occurs. Setting the Cancel argument to True (–1) cancels formatting of the section.
FormatCount An Integer value that specifies whether the Format event has occurred more than once for a section. For example, if a section doesn't fit on one page and part of it moves to the next page of the report, Microsoft Access sets the FormatCount argument to 2.


Remarks

If you cancel formatting, Microsoft Access doesn't format the section for printing and prints the next section instead. You can use this event procedure to skip a section in a report without leaving a blank space on the page when the report is printed.
Nov 23 '06 #2
wattar
2 New Member
Hi Neo,
Thanks for your reply.
I already tried that for almost 2 whole days, but I didn't reach anything.

However, I found a workaround (an ugly one!!), which is tooooo slow, but at least, it is working.

Before opening the report, I had to simulate the running of the parent report query along with the subreport query, and get a list of the project ID's that have Milestones. And then, I created a query at runtime using the QueryDefs, and based the final report on this created query.

It works, but as I told you, it is too slow.

I would still appreciate if someone can help me with a better solution.

Thanks a lot
Nov 23 '06 #3
NeoPa
32,579 Recognized Expert Moderator MVP
OK Wattar.
Post the SQL you're running atm & we'll see what we can come up with.
I suspect it's a question of using a LEFT JOIN rather than an INNER one - but we'd need to see exactly what you've got before moving on that.

BTW Neo is my son's tag - hence NeoPa ;)
Nov 23 '06 #4
MMcCarthy
14,534 Recognized Expert Moderator MVP
Hi all,
I will briefly tell you about the structure of my databse, and then will ask you my question.
I have a database for project tracking, with a table for projects, and some other tables related to the projects table (i.e. Milestones)

I have a report based on a query that selects all the projects that I have and the report is grouped by the project ID. Within this report, I have a subreport for Milestones. the query for the Milestones subreport selects all the project milestones where the project ID = the "Report" ProjectID. This makes the Milestones subreport pick only the milestones for each project ID as per the grouping done in my parent report.

The Problem:
Some projects have no milestones!
I end up having a page in the report where on the top of the page, there is the project name and nothing below it. So of course this doesn't look very presentable.

The Question:
Is there a way using VB or access to completely skip such pages from the repot so I would end up with a report for all projects that actually have milestones?

Thanks for your help!

Wael
If I understand this correctly there is no milestone data currently present in the main report records. If this report is currently based on the table change it to a query or if it may already be a query.

Either way you need to add the milestones table to the query not as a returned field but as criteria only. And exclude null values.

Something like this:

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT ProjectID, Field1, Field2, etc
  3. FROM ProjectTable LEFT JOIN MilestoneTable
  4. ON ProjectTable.ProjectID=MilestoneTable.ProjectID
  5. WHERE MilestoneID Is Not Null;
  6.  
This will only return projects with milestone records.

Can also be written like this (as per NeoPa's suggestion)

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT ProjectID, Field1, Field2, etc
  3. FROM ProjectTable INNER JOIN MilestoneTable
  4. ON ProjectTable.ProjectID=MilestoneTable.ProjectID
  5.  
Nov 23 '06 #5

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

Similar topics

3
2000
by: Mark Turney | last post by:
Problem: I have a vector full of two different derived class objects (class B and class C) that are derived from the same base class A. I want to loop through vector and invoke a member function in only objects of class B and skip over the objects of class C. To complicate things, I'm using the vector position (index) as an argument in the invoked member function. It is possible to move the position into the object by adding a data...
1
1474
by: Fredi Daellenbach | last post by:
Hi all, I have a report with a sub report in it. Everything displays all right, even with records in the main report on >1 page (*). But as soon as there are so many records in the _sub_report that a 2nd page is necessary, the report hangs forever (can be stopped by Esc). With just 1 record less than the "hanging number" there are 2 or 3 empty pages with only the headers of the main report - perhaps a related problem.
1
2037
by: Rosy | last post by:
I am trying to format an address so that if the Billing2 field is empty it skips it and doesn't leave a blank line on my report. I tried putting me.Billing2.visible = not isnull( me.Billing2.value ) in the OnFormat but it tells me the macro has not been saved. What am I doing wrong? Thanks.
1
3777
by: shaqattack1992-newsgroups | last post by:
I know this is kind of a weird question, but is there anyway to give a subreport control of a main report? I posted my situation earlier about having drawings print out after a group. I have a report grouped by part group that lists the part numbers needed from that group. I have force new page after each group. This gives me a list of parts on each page. I want to print the needed drawings after the groups/list of parts. There are...
1
2153
by: Nadia Daems via .NET 247 | last post by:
I desingned a report with several subreports to use in my application. Normally each subreport have to start on a new page. I did this by making a diffrent section for each subreport and selecting the option "New page before" for each section. When a subreport is blank, both the subreport and the section are suppressed but the new page isn't, so there are empty pages in my report. Because the reportheaders of the subreports are suppressed,...
5
2955
by: jimatqsi | last post by:
Here's a reporting problem that keeps haunting me. A lot of my reports give an extra page at the end, showing only headings and no data. What causes that, and how can I prevent it? Thanks, Jim
5
2375
by: andi | last post by:
Hello, I created a report in Acess2000 and now it repeats itself three times. At first I thought its a problem with the page margins but that would mean that empty or almost empty pages would follow the initial report! In my case the whole report repeats itself completely. I hope that someone can help me on that cheers
2
17149
code green
by: code green | last post by:
I am trying to skip empty rows in a csv file The manual states But none of these tests seem to work. Anybody know why while(($data = fgetcsv($this->handle)) !== false) { if(!is_null($data)) #no if(!empty($data)) #no if(!empty($data)) #no { And variations thereof
11
17266
tuxalot
by: tuxalot | last post by:
The easy way is to put cancel = True in the On No Data event of the report. But why replicate code across all reports that way? My app selects reports from a listbox, so I would prefer to check the record count of the query, and if 0, never get to the DoCmd.OpenReport line. Here's the code (case 2 is where I would like to check if the report query has data, and my DCount attempt is not working): ... Dim stDocRS As String 'store...
0
9672
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10436
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10213
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10163
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7538
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6780
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3722
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.