Parameter value to display on a label or text box as header.

S

So-Ange

Hi All,
Please some one, I need help writing a code. this is what I am trying
to achieve: the report has two values (which will be the same) IIF the
Param1 =Param2 say 60303 (a project#) then txtBox ="AWNC" else IIf
70415 txtBox = SOCO and so fourth. I am not sure how to code this in
the onclick event of the button that previews the report. By the way,
my report runs fine with the exception of the 2 prompts for the 2
sub-reports on my main report that has no record source. Ideally I
want prompt 1 = 2 so the use won't have to enter it twice. Help!!!
 
S

Steve Schapel

So-Ange,

I'm afraid I don't entirely understand your meaning. But as regards the
60303="AWNC", 70415="SOCO" etc, do you have this information in a table
somewhere, with the numbers and corresponding codes? If so, then this
table should be included into the query that the report is based on, and
then can be displayed directly in the textbox on your report. It does
not sound like the Click event of a command button would be appropriate.
 
S

So-Ange

Steve,
The Project number is in a table, however I am not sure how to wite the
code: either so a IIf statement in the text box or code the button that
opens the report. I have a button that the user clicks to preview the
report, upon click they are prompted for the Project number of rpt1
which in most cases is the same number for prompt 2 then the report is
preview, however the rpt says Change Orders (good) however what
projecct does it pertain to is the Mystery I need to solve. Please help!
 
S

Steve Schapel

So-Ange,

Why are there two prompts for project number? Does this mean there are
2 fields in the report's underlying query that both contain project
number? And if so, it is sometimes possible for these 2 fields to be
different from each other? If so, this sounds like a problem with the
design of the tables or query.
 
S

So-Ange

Steve, There are 2 prompts because there are 2 sub-reports on the main
Report. I want the Project name to display as part of the report
header Text on a unbound textbox or Label. I hope I have elaborated a
little further. Help this report I just f/o is due tomorrow.
 
S

Steve Schapel

So-Ange,

On the form where there is the button for click to preview the report, I
would recommend to put an unbound textbox (or maybe a combobox will be
applicable here), where you enter the criteria. In your query that the
report is based on, in the place of the Parameter prompt, replace it
with a reference to the criteria control on the form, using syntax such
as...
[Forms]![NameOfForm]![NameOfControl]

You can also do the same on the report, for example put this in the
Control Source of an unbound textbox in the report header...
=[Forms]![NameOfForm]![NameOfControl]
.... and the report will then show what is in the textbox on the form.

If you still need more help with this, please post back with details of
the data you are working with, and some clear examples of what you want.
 

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