Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Delete an empty page in Access Report using VBA

Posted on 2016-09-17
4
Medium Priority
?
80 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 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
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 …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

972 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