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
 
Top