Text entered on frmMain as Report Title

  • Thread starter Thread starter Bryan
  • Start date Start date
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....
 
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
 
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
 
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.<<


.
 
Back
Top