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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filling text boxes at run time

Status
Not open for further replies.

EKelly

Programmer
Jul 3, 2002
49
0
0
IE
Hi all

I am having a problem with filling a text box on a report. What happens is as follows:

When the report opens a text box's control source is set to a field of a table. On the Detail_format section of the report I am calling a function that reads in the information from the text box and parses it to a specific format. What I then want to do is write this new text back into the text box. I am trying to set the text box's control source property to the parsed text but i get the following error message -> "You can't set the control source property in print preview or after printing has started". To get around this I made the text box I am reading from invisible and added a label over it to feed the parsed text back into. This works fine except that there is no word wrap or can grow property in a label, so some of the text is missing in the report.There is no way of knowing how much text will be filled into this label at any one time so its needs to be dynamic.
Has anyone any suggestions?

Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

    'expr is name of text box
    ParseSyntax (Me![expr]) 

    'trying to feed the results of the ParseSyntax function
    'back into the text box
    Me![expr].Properties("ControlSource") = parseContents
Thanks
Erin
 
What is ParseSyntax doing? Can you include the code? Have you tried writing it another textbox instead of a label?
 
The control source of the text box, is a field in a table that consists of text in which the short names of specific items are mentioned. ParseSyntax picks out the short names of these items from this text and searchs the tables record set for the corresponding long names.It then returns a string of the same text except the short names are replaced with the long names of the items.

I have tried to write this altered text from ParseSystax back into a different text box that is not bound to anything but again I get the same error -> "You can't set the control source property in print preview or after printing has started".

Any help?
 
Why aren't the tables related in your source query for the report?
 
The item short name field, long name field and the text field that the text box on the report is being filled from are all on the same table and they are in the source query for the report. The text contains a sentence with the item short names in it and when that text appears in the report in a text box I want it to have the item long names in it. Thats why im using the VBA to parse the text.

Any clearer?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top