Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic population of text boxes

Status
Not open for further replies.

schwarem

Programmer
Joined
Apr 18, 2002
Messages
159
Location
US
I am trying to make a report that has a whole lot of queries in it. I want to create them at run time with the Open event. I have no trouble creating the queries and populating them in a recordset, but I can't get the result into a textbox. I have tried all kinds of things. I have tried
txtResult = rst!cnt
txtResult.text = rst!cnt
txtResult.value = rst!cnt

No matter what I do I get "Object does not support this property or method," error.
 
Its not what you're doing - its when you're doing it.

You can't do this in the Open event because the text boxes don't actually exist as far as the report is concerned until after the Open Event is complete

On_Activate
txtResult = rst!cnt

works fine because the controls are, by then, inplace and ready to accept the data


QED?


G LS
 
I figured it out. Thank you.
 
I have a similar problem. The values I want to plug into some unbound text boxes are actually present in my VBA code but when I attempt to insert them into the fields I get no response on the open report.

The only options I see at present are to create a form with some text fields, hide it at run time and have the report fields point to this as the data source.

Is there any way to plug my existing variables into an open report without having to resort to global variables or a hidden form?

' strSampleCode & strProductType already exist
'Open the report
DoCmd.OpenReport "rptCustomTestReport", acViewPreview
DoCmd.SelectObject acReport, "rptCustomTestReport"
'Neither of these work
Reports!rptCustomTestReport!txtSampleCode.Name = strSampleCode
Reports!rptCustomTestReport!txtProductType.Value = strProductType
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top