Repost: Automating Reports Title from Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Repost of question from yesterday,

I didnt explain my question fully. I wanted to set the value of a reports
heading from VBA not from the form itself. I have 2 strings which are set
when the user selects certain controls on my form. I would like to apply
these to the report. I tried to apply them with the with statement below but
this doesnt work as Allen Brown explained. How can I set the properties of
the controls from VBA, I also tried to set them before the report is open but
this brings up the error rptDynamicTopSuppliers either does not exist or is
not open.



Hi

How can I set the value of a heading on a report from VBA.

I have tried.

With Reports![rptDynamicTopSuppliers
..txtHeading.Value = strHeading
..txtSubHeading.Value = strSubHeading
End With

But neothing is displayed in the text boxes. Can anyone help?

Thanks


Was this post helpful to you?
Reply Top





Allen Browne

11/25/2004 8:48 AM PST
Re: Automating Reports Title from Form

In: microsoft.public.access.formscoding



You cannot push the value from the form onto the report, because the report
must have it at the time it formats that section.

You can get the report to read the value from the form. For example, set the
Control Source property of the txtHeading text box on the report to:
=[Forms].[Form1].[text1]
 
As Allen explained, you can't push the values into the report.
You can set them in the report's OnOpen event, however.
I've had better luck setting the Caption property of a label, than the Value
of a textbox.

Make sure your variables are declared as Public in a standard module, so
they'll be visible from the report's module.

HTH
- Turtle

Edgar Thoemmes said:
Repost of question from yesterday,

I didnt explain my question fully. I wanted to set the value of a reports
heading from VBA not from the form itself. I have 2 strings which are set
when the user selects certain controls on my form. I would like to apply
these to the report. I tried to apply them with the with statement below but
this doesnt work as Allen Brown explained. How can I set the properties of
the controls from VBA, I also tried to set them before the report is open but
this brings up the error rptDynamicTopSuppliers either does not exist or is
not open.



Hi

How can I set the value of a heading on a report from VBA.

I have tried.

With Reports![rptDynamicTopSuppliers
.txtHeading.Value = strHeading
.txtSubHeading.Value = strSubHeading
End With

But neothing is displayed in the text boxes. Can anyone help?

Thanks


Was this post helpful to you?
Reply Top





Allen Browne

11/25/2004 8:48 AM PST
Re: Automating Reports Title from Form

In: microsoft.public.access.formscoding



You cannot push the value from the form onto the report, because the report
must have it at the time it formats that section.

You can get the report to read the value from the form. For example, set the
Control Source property of the txtHeading text box on the report to:
=[Forms].[Form1].[text1]

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

How can I set the value of a heading on a report from VBA.

I have tried.

With Reports![rptDynamicTopSuppliers
.txtHeading.Value = strHeading
.txtSubHeading.Value = strSubHeading
End With

But neothing is displayed in the text boxes. Can anyone help?

Thanks
 
Back
Top