newbie Report question

B

Becky

I have a form called frmA with a combobox called cboA and a button called cmdA.
cmdA's Click event opens a report called rptA. The code is the usual...

DoCmd.OpenReport "rptA, acViewPreview

Here's the simple thing that I can't get to work properly. rptA has, among
other things, a label called lblA. When the report opens, I want the lblA's
caption to be the value of the cboA at the time cmdA was clicked.

Does this involve OpenArgs??? How can I get this to work?
 
M

Marshall Barton

Becky said:
I have a form called frmA with a combobox called cboA and a button called cmdA.
cmdA's Click event opens a report called rptA. The code is the usual...

DoCmd.OpenReport "rptA, acViewPreview

Here's the simple thing that I can't get to work properly. rptA has, among
other things, a label called lblA. When the report opens, I want the lblA's
caption to be the value of the cboA at the time cmdA was clicked.

Does this involve OpenArgs??? How can I get this to work?


You could use OpenArgs:
DoCmd.OpenReport "rptA, acViewPreview, _
OpenArgs:= cboA
and in the report's Open event:
Me.lblA.Caption = Me.OpenArgs

It might be easier for the report to use a text box (instead
of a label) with an expression like:
=Forms!frmA.cboA
 

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