Set Value On Report

T

TH

I am creating a recipe database and I want to label a report based on which
search criteria are selected. For instance, if a person is printing an
alphabetical list I want the report labeled as such and if the person
selected recipes from a particular individual I want the report to say (for
instance) "Nancy's Recipes". In the report header, I have an unbound text
box followed by a label titled "Recipes". I have tried the SetValue action
in a macro and for some reason it is not working (for the expression I have
the word I want to label the report with enclosed in quotations). It tells
me that "You can't assign a value to this object". Any help would be
appreciated. Thanks.

Tonye
 
S

Steve Schapel

Tonye,

You mentioned the idea you used for the Expression argument in the
SetValue macro, but you didn't mention the Item. This would probably
need to be either the Caption property of a Label, or the
ControlSource property of a Textbox. If the latter, the Expression
would need to have an = sign in front of it.

You didn't mention where you are planning to use the macro. Possibly
the On Format event of the Report Header section would be the way to
go?

You didn't mention how the person is supposed to make the selection of
which recipes are to be included in the report. If they are using a
control on a form to make the selection, or if you are using a
Parameter Query, then the reference to the form control, or to the
query parameter, can be put directly into the controlsource of a
textbox on the report, without the necessity of a macro at all.

- Steve Schapel, Microsoft Access MVP
 
T

TH

Steve,

The Item for the argument of the SetValue macro is the name of an unbound
text box on the report. Origionally, the macro ran on the OnOpen event of
the report. I moved it to the OnFormat event for the header section.

You asked how the person selects which recipes are included in the report.
This is done using a swichboard to select how a person wants to sort the
recipes (alphabetical, by selected ingredients, by the name of the person
who the recipe is from etc). After selecting how the sorting is to be done
on the swichboard, the person can then narrow the search further (ie select
the name of the person whose recipes they want to view) and then click a
yes/no box to show which particular recipes are to be shown. Because of how
all this is done, I don't think a Parameter Query would work. I could be
wrong though. I'm not the best with all of this.

Right now I changed it to display the name of the first type of list
(alphabetical) when that option was selected (otherwise that label is
hidden). As I create the other forms I will have to address this question
again because the sorting will get more specific than just alphabetical (ie
a person will select "Nancy" from a drop down combo box to show all those
recipes and then click the yes/no box to select which of the recipes from
"Nancy" they want to show).

If I wanted to set the caption property of the label in the future, how
would I refer to that?

Thanks for your time and help.

Tonye
 

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