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

Identifying Specific Text Object from a collection of Text Objects

Status
Not open for further replies.

gregoriw

Programmer
Sep 21, 2001
40
US
How do you identify one particular Text Object in a section that contains ten different Text Objects?

I'm trying to use SetText method of the RDC (version 8 and VB 6) to put values into specific text objects but the RDC doesn't appear to give you a way to recognize which object has which field name associated with it. If I put an UnBound item on the RDC report, it is easily identified as @UnBoundString1. But with a text object, it doesn't give you a name. Even if you hover the mouse over the text object you just put down, the bubble help doesn't give it a field name that you can easily identify it with.

When you go to VB and press the F2 button to get VB's Object Browser, it does list all the Text Object's name as Text1, Text2, Text3. But like I said, how can you visibly tell which text object on the report is Text2? Seems like there's a lot of hunting and pecking going on to find just the field you want to issue the SetText to. And I'm not to crazy having to code something like

For Each Text Object in XXXX
'do this
Next

Seems like you should be able to pinpoint just the one Text Object you want (instead of filtering through a bunch of them) just like you can if you've established a database field on the report.

Any ideas?

 
I too have had this aggravation. For areas where I only wanted to change specific text boxes I changed them to formulas. They were then easily identifiable.

Lisa
 
Thanks for the reply. I felt that this issue was great enough to begin a good thread of discussion. Perhaps Crystal Reports/Decisions has a fix somewhere. Version 8.5??? or Version 9???

One thing that I ended up doing was insert a separate function in my VB code and based on the number of text objects I had in the report designer, I put default text identification that would point out what and where each different text object existed on the report. A general waste of time but one that I felt needed to be done to finally figure out who's on first, what's on second,...

Please review this code to see if you could use it to help you out...
================ code begins here =========================
Private Function FindTextBoxes() As Boolean
On Error GoTo ErrHandler

FindTextBoxes = False

With mdsrReport
.Text1.SetText "TextObject 1"
.Text2.SetText "TextObject 2"
.Text3.SetText "TextObject 3"
.Text4.SetText "TextObject 4"
.Text5.SetText "TextObject 5"
.Text6.SetText "TextObject 6"
.Text7.SetText "TextObject 7"
.Text8.SetText "TextObject 8"
.Text9.SetText "TextObject 9"
.Text10.SetText "TextObject 10"
.Text11.SetText "TextObject 11"
.Text12.SetText "TextObject 12"
.Text13.SetText "TextObject 13"
.Text14.SetText "TextObject 14"
.Text15.SetText "TextObject 15"
.Text16.SetText "TextObject 16"
.Text17.SetText "TextObject 17"
.Text18.SetText "TextObject 18"
.Text19.SetText "TextObject 19"
.Text20.SetText "TextObject 20"
.Text21.SetText "TextObject 21"
.Text22.SetText "TextObject 22"
.Text23.SetText "TextObject 23"
.Text24.SetText "TextObject 24"
End With

FindTextBoxes = True

Exit Function

ErrHandler:
Print #gintFreeFile, Date$ & " / " & Time$ & ": Error in FindTextBoxes - Err.num=" & Err.Number & _
" near line number=" & VBA.Erl & vbCrLf & " description=" & Err.Description & vbCrLf

FindTextBoxes = False

End Function

================ code ends here =========================

I thought of adapting everything to Formulas too but I thought that would add unnecessary overhead to the formula processors inside the report. It would be be ok I think if you had one or two text objects converted to Formulas but you see I still have over 30 more text objects to place on this report.

If anyone else knows of another way to identify which which Text Object on a report is which field, please reply.

Thanks
Wolfgang

 
The problem with not using formulas.. What do you do when six months down the road something changes again? You have to add/delete boxes. Especially deleting. As I recall (and it has been awhile) if you delete text box 4, text box 5 becomes 4, 6 becomes 5 etc.

In the long run, for maintainability and ease in working with them in the code, changing them to formulas made life much easier.

Lisa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top