Problem setting unbound text box control source

Opengrave

Registered User.
Local time
Today, 04:18
Joined
Sep 6, 2001
Messages
70
I am having an odd problem. I have a report that has an On Open even procedure that pulls data from a list box (on a form that launches this report) and concatenates several values in the list box into one string called StrClassNames. After that I try to set the ControlSource of a text box in the report called txtClasses to StrClassNames.
Code:
Me![txtClassNames].ControlSource = StrClassNames
The problem is that when I open the report it asks me to input a parameter (like in a parameter query). As part of debugging I went into the VB editor and tured on the immediate window and did a ?StrClassNames and got values as expected, in addition when I mouseover the variable in debug mode I get the values I expect as well. The other odd thing is that the text in the message box that pops up asking for a parameter is always the first row of the StrClassNames.

Can anyone give me direction as to what is going on? Any possible solutions are appreciated.
 
What are you trying to do exactly? Only print out the value of your StrClassNames in your textbox or really set the control of your textbox to the field pointed by StrClassNames?

If you are trying option 1, I suggest to change your code to :

Me![txtClassNames].Value = StrClassNames


Mario
 
I am trying to get the text box txtClassNames to display the text in the string called StrClassNames. I tried

Me![txtClassNames].Value = StrClassNames

and got the debug message box saying I can't set the value of this item. As I work around I am using a Label and setting the caption. The formatting is not what I want but it works.
 
Me.txtClassNames = StrClassNames

I still get "You cannot assign a value to this object".

I wonder if this has anything to do with the fact that StrClassNames contains "hard return" (vbCrLf) characters. It should display as a list:
1st Grade
2nd Grade
3rd Grade

but the string is built by adding 1st grade and a vbCrLf and 2nd Grade and a vbCrLf and 3rd Grade.

At any rate my workaround with the Label / Caption works. I appreciate everyone's assistance with this.
 
On Format FINALLY got the string into the text box. Now the 'Can Grow' doesn't seem to work but I can work on that. Thanks for all the help!
 

Users who are viewing this thread

Back
Top Bottom