Report label format

G

Guest

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
 
D

Duane Hookom

Not sure if you a working with subforms or subreports on a report or what?
You might consider changing your label to a text box and setting its control
source to something like:
=IIf([Parent.Name = "rptCustomerBikes","Value", "Cost")
 
O

OfficeDev18 via AccessMonster.com

You're probably opening the wheels form with a DoCmd.OpenForm statement from
the previous form or report. If so, add an OpenArgs argument, like so:

DoCmd.OpenForm "wheels",,,,,,"Cost"

when opening it from the one form, and

DoCmd.OpenForm "wheels",,,,,,"Value"

when opening it from the Customer bicycles report.

In the "wheels" form, in the Open event, put the following code, to capture
the OpenArgs:

Dim OA As String

OA = Me.OpenArgs
Me.lblLabelName.Value = OA

That should do what you want. Be aware, though, that with this code you must
use an OpenArgs argument every time you open the form.

Hope this helps,

Sam
 
G

Guest

Duane,
They are all forms dropped into the detail section of my report, the field
i'm trying to change is the caption field on the format tab.

Duane Hookom said:
Not sure if you a working with subforms or subreports on a report or what?
You might consider changing your label to a text box and setting its control
source to something like:
=IIf([Parent.Name = "rptCustomerBikes","Value", "Cost")


--
Duane Hookom
MS Access MVP

Jedit said:
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
 
G

Guest

Sam,
You got it, However, I do have a button that opens the report not a form,
the report has all the forms in the detail section, I had thought about
placing code in there but cant figure out where to place it, tried it in the
on open event but get an error, like the sound of your solution but don't
know where to place the openArg argument?

DoCmd.OpenForm "wheels",,,,,,"Cost" what is this line doing???? I
understand that its opening the form Wheels but not sure what "cost" is for?
 
O

OfficeDev18 via AccessMonster.com

See the OpenForm method in the help files. The last property is the OpenArgs
argument for the form being opened. In other words, the statement is telling
Access to open the form with "Cost" as an OpenArgs argument. What you do with
the value there is not Access' business. In this case, you are using the OA
to initialize the caption of a label. However, to capture this value you must
access it right away or it gets lost, for some reason. This is why I said to
put the code in the Open event (the Load event might work just as well).

"However, I do have a button that opens the report not a form"

Isn't the button on a form? Then you're opening the report from a form, and
the code I gave you should work, unless I'm missing something.

Sam
Sam,
You got it, However, I do have a button that opens the report not a form,
the report has all the forms in the detail section, I had thought about
placing code in there but cant figure out where to place it, tried it in the
on open event but get an error, like the sound of your solution but don't
know where to place the openArg argument?

DoCmd.OpenForm "wheels",,,,,,"Cost" what is this line doing???? I
understand that its opening the form Wheels but not sure what "cost" is for?
You're probably opening the wheels form with a DoCmd.OpenForm statement from
the previous form or report. If so, add an OpenArgs argument, like so:
[quoted text clipped - 35 lines]
 

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