473,407 Members | 2,598 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,407 software developers and data experts.

set titlle of report based on button clicked on in the main form

9
I have one report with several buttons to open the report based on filters on the buttons. when button "A" is pressed, I want title of report to be "A"
when button "B" is clicked, title should be "B"
thanks
Jan 5 '15 #1

✓ answered by twinnyfo

Seth,

Good solution. I always forget about that option--which has been around forever--because I haven't had a need to use it.

Clearly the easier solution in this situation. Thanks!

10 1442
twinnyfo
3,653 Expert Mod 2GB
Expand|Select|Wrap|Line Numbers
  1. Reports![ReportName].Caption
will change the name of the report in its window, but I think you may be talking about a Title that prints on your Report?

If this is the case, the easiest way I can think of is to have the Title generated when you set the filters.

After the report is opened, use VBA to change either a Text Box or Label based on the Filters. E.g., button A is clicked,

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "ReportName", , , "WHERE Conditions"
  2. Reports![ReportName].txtTitle = "This is Report A"
I think that should help. Let us know if you run across other snags.
Jan 5 '15 #2
dovidg
9
thank you for your responce
this is my code
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "RptUnion", acViewPreview, , "Check=-1"
  2. Reports![RptUnion].Title5 = "This is Report A"
title5 is an unbound textbox
there is no error message in the code but the text box is empty

thank you
dovid
Jan 5 '15 #3
twinnyfo
3,653 Expert Mod 2GB
That was unexpected--although I had not tried that before. based on how Access uses all other Objects, one could only assume the same would work for reports......

Is there a way you could establish a Global Variable using TempVars()? This could hold a value, then the Control Source for that Text box could be the value of the Variable.

Your Code to open the report would be:

Expand|Select|Wrap|Line Numbers
  1. Dim strReportName As String
  2. strReportName = "This is Report A"
  3. TempVars.Add "ReportName", strReportName
  4. DoCmd.OpenReport "RptUnion", acViewPreview
Then, the Control Source for the Text box is:

Expand|Select|Wrap|Line Numbers
  1. = TempVars("ReportName")
Hope this hepps!
Jan 5 '15 #4
Seth Schrock
2,965 Expert 2GB
Instead of using a Tempvar, I would just add an OpenArgs to the DoCmd.OpenReport command and then use the report's OnLoad event to set the value of Title5 to the value in the OpenArgs property.

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "RptUnion", acViewPreview, , "Check = -1", , "This is Report A"
Then in the report's OnLoad event,
Expand|Select|Wrap|Line Numbers
  1. Me.Title5 = Me.OpenArgs
Jan 5 '15 #5
twinnyfo
3,653 Expert Mod 2GB
Seth,

Good solution. I always forget about that option--which has been around forever--because I haven't had a need to use it.

Clearly the easier solution in this situation. Thanks!
Jan 5 '15 #6
dovidg
9
perfect, thanks for everything
dovid
Jan 5 '15 #7
twinnyfo
3,653 Expert Mod 2GB
I would suggest selecting Post #5 as the answer for this thread....
Jan 6 '15 #8
twinnyfo
3,653 Expert Mod 2GB
Your call to open the report would be:

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "RptUnion", acViewPreview, , "Check = -1", , 1 'or 2 or 3
The title is set in the OnOpen event as well.
Jan 8 '15 #9
zmbd
5,501 Expert Mod 4TB
<Split second question into its own thread>
Handle Multiple Reporting Options
Jan 8 '15 #10
dovidg
9
took me a bit to get it to work but it's perfect
learned a lot of new options
thanks for everything
dovid
Jan 8 '15 #11

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

Similar topics

2
by: Patrick | last post by:
i have the following .aspx file defined: ..... other tags here ... <asp:TableCell><asp:button id="AddButton" Runat="server" Text="Add New Vessel..."</asp:button></asp:TableCell> ..... other tags...
1
by: fleece | last post by:
I have a continuous form based on some selected criteria. Now I want to send the search results to a report. How could I do that? It's better if I could sort the results before export to report. ...
5
by: favor08 | last post by:
have a mainform called PendingsMain and a subform called PendingsSub. You can filter the subform by different filters and this works fine. i want to create a report that will print out the...
3
by: Apple001 | last post by:
I am having hard time finding the way to make the database below. I have: -Form "frmInvoice" with subform "Allocation" based on table "tblInvoice" and "tblAllocation". "invID" is auto number in...
1
by: rkm2 | last post by:
I currently have a form "UserSearchForm" which allows a user to select values from several different unbound combo boxes in the header section and press a search command which filters the list in the...
2
by: darnnnel | last post by:
Hi everyone! I’m not sure how to even begin. I have a form and a subform and they are not linked. I would like to have a button on the form that would only change the data in the subform,...
1
by: QCLee | last post by:
Hello Sir, Im here again asking for help. I have a form and a subform relate to HVAC Windward Table. i have a SAVE button on the form that when clicked it saves data on the HVAC Windward Table but...
16
by: Steve | last post by:
I am working on a database that has a main menu, many sub-menus and some sub-sub-menus. They are all forms that have numerous command buttons on them to open forms and reports in the database. The...
2
by: John Lewis | last post by:
I have created a windows form application using an Access 2003 db. I used the drag and drop methods to place the fields on the forms and the same with the second form using the related table from the...
4
beacon
by: beacon | last post by:
Hi everybody, I have a main form, frmDeficiency, that has a tab control, deficiencyTabControl, that has a subform, fsubEpisodeDetail, on page 2 of the tab control. I also have a command button...
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
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,...
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...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.