REport Label

G

Guest

I have a report with 4 sub forms in it, each are formatted to display in
Datasheet view, what I would like to do is change the name label that is
displayed for one form to something when the report loads.
i.e. Form displays Cost as the label / header with say 10 values bellow it,
I want to change the word “cost†to “value†when the report loads.
I have tried but get an error saying the property can be changed in edit
only?
 
A

Al Camp

Jedit,
When opening the report, use the OpenArgs argument in the OpenReport method to
differentiate between the two situations.
DoCmd.OpenReport "YourReport",,, "Cost"
vs.
DoCmd.OpenReport "YourReport",,, "Value"

Then in whatever section of the report you have your header label... on the Format
event,
If OpenArgs = "Cost" Then
MyLabel.Caption = "Cost"
Else If OpenArgs = "Value" Then
MyLabel.Caption = "Value"
End If

or simpler...
MyLabel.Caption = OpenArgs
 
G

Guest

That looks really good! However, not knowing a lot about code I’m struggling
to see where to put it. Also, I think we are getting slightly confused here
so I will explain again.

I have a report for Customer bicycles; in this report I show four categories
Wheel, Seat, Chain & Tyre.
Each of these categories has a form that lists the quantity a customer has
bought, e.g. Joe Bloggs bought 2 wheels, 1 seat, 3 chains & 10 tyres all of
which shows on the report as I would want it.
The exception is to the caption displaying the wrong word on the wheel form,
so when I open the report, Customer bicycles, I want to alter the caption
from Cost to Value for the wheels form that is located in the detail section
of the Customer bicycles report. It’s also worth noting that this form is
used in another report and that’s why I need to change the name.


In simple terms. When I open the Customer Bicycles report change the
caption from Cost to Value for the wheels form
 
A

Al Camp

Jedit,
In simple terms. When I open the Customer Bicycles report change the
caption from Cost to Value for the wheels form

What version of Access are you using? In this case, it makes a difference.
There's a simple solution in 2003, but we'll have to handle it differently for 97 and
2000.

(Also, a minor point... please don't <snip> any replies to your question. Just leave
them
in the "thread" so that everyone cann see what the sequence of the entire conversation
has been. Thanks...)

--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
 
G

Guest

No problem,
I use access 2000, thanks!

Al Camp said:
Jedit,

What version of Access are you using? In this case, it makes a difference.
There's a simple solution in 2003, but we'll have to handle it differently for 97 and
2000.

(Also, a minor point... please don't <snip> any replies to your question. Just leave
them
in the "thread" so that everyone cann see what the sequence of the entire conversation
has been. Thanks...)

--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
 
A

Al Camp

Jedit,
Well, unfortunately there is a bit of a problem.
Access 2000 doesn't have an OpenArgs argument in the OpenReport method.
Access 2002 and beyond does.

So, an easy way is to use a hidden unbound TEXT control on the form that calls the
report, and have the report use that value as the text it uses.
(ex. [ReportText] field on frmBicycle)
When you click your Bicycle button, make ReportText on the form "Value"
On your report, create an unbound TEXT control with this as the ControlSource...
= Forms!frmBicycle!ReportText
Whatever ReportText is set to on the form, it will be displayed on your report. (Cost,
Value, etc...)
Of course, the form must remain open as the report runs.
 
G

Guest

Al,
I got it slightly wrong & I Need it to be the other way round.
I need to change the name field on the other TAB of the Forms!frmBicycleto
show the word "VALUE"
when I open the report, the form (Forms!frmBicycle) is included in the
report as a dataview & is not previously opened.


Al Camp said:
Jedit,
Well, unfortunately there is a bit of a problem.
Access 2000 doesn't have an OpenArgs argument in the OpenReport method.
Access 2002 and beyond does.

So, an easy way is to use a hidden unbound TEXT control on the form that calls the
report, and have the report use that value as the text it uses.
(ex. [ReportText] field on frmBicycle)
When you click your Bicycle button, make ReportText on the form "Value"
On your report, create an unbound TEXT control with this as the ControlSource...
= Forms!frmBicycle!ReportText
Whatever ReportText is set to on the form, it will be displayed on your report. (Cost,
Value, etc...)
Of course, the form must remain open as the report runs.

--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


Jedit said:
No problem,
I use access 2000, thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top