Set Report Control Value from Code

D

D. McDonough

I have created a report. I want to show a value in a text
box on this report ... this value is calculated/specified
by me in the Activate event procedure for the report.

When I try to set the value of the text box, I get the
following error (Run-tim error '2185'):

You can't reference a property or method for a control
unless the control has the focus.


How can I do what I want to do?? (My sample code is below.)

Thanks!


Here's an example:

Private Sub Report_Activate()
Dim myCtrl As Control
Dim extraValue as Long

extraValue = 171717

For Each myCtrl In Me.Controls
If myCtrl.Properties("Name") = "ExtraValue" Then
myCtrl.Properties("Text") = extraValue 'errors
End If
Next
End Sub
 

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