473,387 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to have a different "first page" from "other pages" in a report?

sueb
379 256MB
I'm implementing a report that has an entirely different first page than the rest of the pages (the first page gets printed on an original form, but the following pages have their much-more-simple form embedded in the Access report).

Currently, I have two separate reports, invoked sequentially by a single button on the menu. Clicking that button requres the user to enter the Account number twice, once for each report:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Preview_An_18_1_Click()
  2. On Error GoTo Err_Preview_An_18_1_Click
  3.     Dim stDocName As String
  4.     stDocName = "18-1 first page"
  5.     DoCmd.OpenReport stDocName, acPreview
  6.     stDocName = "18-1 Continuation"
  7.     DoCmd.OpenReport stDocName, acPreview
  8. Exit_Preview_An_18_1_Click:
  9.     Exit Sub
  10. Err_Preview_An_18_1_Click:
  11.     MsgBox Err.Description
  12.     Resume Exit_Preview_An_18_1_Click
  13. End Sub
  14.  

I'd like to do one of two things:

1. Figure out how to pass the entered account number in to the second report, or

2. Figure out how I could make a "first page"-"other pages" kind of arrangement in the Access report itself.

This last would be preferable, but I have a suspicion that it's not possible.
Apr 11 '11 #1

✓ answered by TheSmileyCoder

Hi again Sue

There are several ways to open a report.
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport(ReportName, View, FilterName, WhereCondition, WindowMode, OpenArgs)
Passing the Openargs itself does nothing, you must handle it in within the report. Another simpler option is to use a Where condition, and I think that would suit your case.

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport stDocName , acPreview, , "[AccountNumber]=" & strAccountNumber
Regarding the page header/footer, you can cancel the printing of those. For example to have no page footer on the first page:
Expand|Select|Wrap|Line Numbers
  1. Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As Integer)
  2.     Cancel = (Page = 1)
  3. End Sub

6 5200
TheSmileyCoder
2,322 Expert Mod 2GB
You can look into openArgs (Opening arguments) which is basicly a variable you can pass to the form when opening it. Another option is to store it as a global variable and retrieving it.

In a simple report you can place your first page(s) report in the report header. A report header gets printed before the rest of the report (and a report footer at the end).
Apr 11 '11 #2
sueb
379 256MB
Ooh, those are great ideas, SmileyCoder! Thanks--I'll try those and post back.
Apr 11 '11 #3
sueb
379 256MB
Well, this almost did what I wanted, but the kicker is the page footer required in the second report: I couldn't find a way to prevent its printing at the bottom of the Report Header page, so the "single report" idea doesn't seem to fit the bill.

And, I couldn't figure out how to pass to the reports' queries an account number entered by the user into an InputBox, so the user still has to enter the account number twice. I put the InputBox's contents into each report call's OpenArgs list, but the reports print all records instead of the one specified. Here's that bit of code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Preview_An_18_1_Click()
  2. On Error GoTo Err_Preview_An_18_1_Click
  3.  
  4.     Dim strMsg As String
  5.     Dim strAccountNumber As String
  6.     Dim stDocName As String
  7.  
  8.     strMsg = "Please enter the account number, or click OK to cancel. "
  9.  
  10.     strAccountNumber = InputBox$(strMsg, "Account Number")
  11.  
  12.     stDocName = "18-1 first page"
  13.     DoCmd.OpenReport stDocName, acPreview, , , , strAccountNumber
  14.     stDocName = "18-1 Continuation"
  15.     DoCmd.OpenReport stDocName, acPreview, , , , strAccountNumber
  16.  
  17. Exit_Preview_An_18_1_Click:
  18.     Exit Sub
  19. Err_Preview_An_18_1_Click:
  20.     MsgBox Err.Description
  21.     Resume Exit_Preview_An_18_1_Click
  22.  
  23. End Sub
  24.  
This successfully asks the user for the account number, but I'm obviously not handling it correctly after that.

Either one of these solutions would have fixed the problem, but I have so far failed to make either idea work.
Apr 11 '11 #4
TheSmileyCoder
2,322 Expert Mod 2GB
Hi again Sue

There are several ways to open a report.
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport(ReportName, View, FilterName, WhereCondition, WindowMode, OpenArgs)
Passing the Openargs itself does nothing, you must handle it in within the report. Another simpler option is to use a Where condition, and I think that would suit your case.

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport stDocName , acPreview, , "[AccountNumber]=" & strAccountNumber
Regarding the page header/footer, you can cancel the printing of those. For example to have no page footer on the first page:
Expand|Select|Wrap|Line Numbers
  1. Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As Integer)
  2.     Cancel = (Page = 1)
  3. End Sub
Apr 12 '11 #5
sueb
379 256MB
Thanks, SmileyCoder! The extent of your knowledge is really amazing.
Apr 12 '11 #6
Thank you. It was exactly what I was looking for. It even solved several issues I did not know I had until you showed me how to fix this.
Dec 2 '16 #7

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

Similar topics

5
by: Martien van Wanrooij | last post by:
I would like to retrieve, let us say, the First Monday after a certain date, so my (imaginary) function could be something like echo weekdayAfter("28 July 2005", "Monday") should return "1 August...
1
by: Roger | last post by:
I couldn't find anything at http://www.mvps.org/access/reports/index.html I have a report with static (name, address, etc) in its report header and a subreport in the report's detail section ...
1
by: iam247 | last post by:
Hi I have a web page which receives information from a form (using request.form) and also attempts to look at an Access query to read in recoeds to a variable named rsGroup. When I have the...
6
by: José Joye | last post by:
Hello, I'm currently reading the MS Developing Web applications with c# (and VB.net). In the chapter related to Error management, there is a sample about "Page-Level Error Pages" eg: In my...
1
by: emon.haider | last post by:
Hi guys, I just made a web application using ASP.Net and C#. The application compiles and works fine from my workstation, but after I uploaded it to my webserver, I am getting an error of "the...
0
by: cherryparadise001 | last post by:
Hi All, I have moved an asp system from Window Server 2000 to Window Server 2003 recently. Many error occured and most of them are unable to get the control's value in the page. I am newbie to...
9
by: MadingS | last post by:
Is there an HTML (or CSS) way to say "use the user's INPUT font, whatever that might be."? Most browsers have the ability for the user to pick his or her own preference for what font to use...
1
by: =?ISO-8859-1?Q?Lasse_V=E5gs=E6ther_Karlsen?= | last post by:
I get the above error in some of the ASP.NET web applications on a server, and I need some help figuring out how to deal with it. This is a rather long post, and I hope I have enough details that...
3
by: Willy | last post by:
I have a website that uses querystrings on a certain page to show multiple contents. I have created mapped pages to hide the gory details of these querystrings. So instead of...
0
by: CoreyReynolds | last post by:
Hey all, I have a piece of code that dumps a bunch of data into a spreadsheet. Also rearranges it into a pivot table and then graphs the pivot table as well so my boss can get a clear view of the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...

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.