Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Delete an empty page in Access Report using VBA

Posted on 2016-09-17
4
Medium Priority
?
74 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 22
ID: 41803260
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
ID: 41803262
I agree a 100% but it is too cumbersome to change at this point in time.... Thanks Michael
0
 
LVL 22
ID: 41803265
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 58

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 2000 total points
ID: 41803321
<<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

Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
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…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

704 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