Solved

Delete an empty page in Access Report using VBA

Posted on 2016-09-17
4
34 Views
Last Modified: 2016-09-23
I have a report template which has up to 5 pages per reservation (allows for up to 5 guests to register under one reservation). Now if I only have one or two guests in a singe reservation I need to suppress or delete the extra pages. Is there any easy way to delete the current page of a report using vba access? Thanks for any help. Rg Michael
0
Comment
Question by:mpim
  • 2
4 Comments
 
LVL 18
Comment Utility
sounds like you have fields for each set of guests instead of making a related table.  If you do the latter, the report can print just what is there.
1
 

Author Comment

by:mpim
Comment Utility
I agree a 100% but it is too cumbersome to change at this point in time.... Thanks Michael
0
 
LVL 18
Comment Utility
it is actually a lot less cumbersome to change it than it is to be figuring out how to get around it ;) ~

all you need to do is make the table, put a foreign key in to the reservation (use AutoNumber in reservations and Long integer with no default value in related table) then make a form to be used as a subform on the reservation form (or whatever you call it), put ReservationID on it (can be hidden -- Visible=No), set LinkMasterFields and LinkChildFields for the subform (which you can drag from the navigation pane to the main form in design view) to be ReservationID , and let Access do its magic! Reporting is just as easy
0
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
Comment Utility
<<Is there any easy way to delete the current page of a report using vba access?>>

In short, no.   But you can set the section (assuming detail), CanShrink property to yes, and in the OnFormat event for the section, check each control:

 If NZ(Me.<somecontrol>,"") = ""  Then
     Me.<somecontrol>.Visible = False
 Else
     Me.<somecontrol>.Visible = True
 End if

 and repeat that for each control.   Assuming you have no grid lines or other controls, that should get rid of the blank pages.

Jim.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
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…

772 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

9 Experts available now in Live!

Get 1:1 Help Now