Text entered on frmMain as Report Title

B

Bryan

I want to use a textbox on frmMain to populate a label in
a report, (I am launching the report using a btn on
frmMain "docmd.openreport "Rpt",acViewPreview")

Private Sub Report_Open(Cancel As Integer)
Me!label.Caption = Forms!frmMain!txtHeading.Text
End Sub

I get runtime error "Can't reference a property or method
for a control unless the control has the focus."

Thanks....
 
R

Ruskin Hardie

Have you tried using a text box, instead of label, on your report.... Then
in the ControlSource of the text box, use;
=Forms!frmMain!txtHeading.Text
 
B

Bruce M. Thompson

Me!label.Caption = Forms!frmMain!txtHeading.Text

You can't reference the "Text" property unless the control has the focus. try,
instead:

Me!label.Caption = Forms!frmMain!txtHeading.Value
 
B

bryan

Great thanks!
-----Original Message-----

You can't reference the "Text" property unless the control has the focus. try,
instead:

Me!label.Caption = Forms!frmMain!txtHeading.Value

--
Bruce M. Thompson
(e-mail address removed) (See the Access FAQ at http://www.mvps.org/access)
within the newsgroups so that all might benefit.<<


.
 

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