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

How to get controltiptext to activate

Status
Not open for further replies.

jnrdavo

Programmer
Jan 8, 2003
11
I've been manually changing all the controltiptext's on a form and decided I'd write some code to do it for me.

The code below works, but when I display the properties of a control, it's blank.

Any suggestions?

------------------------

Function fn_TRASH(FRMCURRENT As Form) As Boolean

For Each Ctrl In FRMCURRENT.Controls



If Ctrl.Name > 1 And Ctrl.Name < 27 Then

With Ctrl
Ctrl.ControlTipText = "TEST " & Ctrl.Caption
End With

End If


Next Ctrl


MsgBox "done!"


end function
 
You really have numeric control names ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
How are ya jnrdavo . . . . . .

I couldn't agree with [blue]PHV[/blue] more. Numeric control names is a bad idea!
[blue]The code below works, but when I display the properties of a control, it's blank.[/blue]
[blue]Form & Control Properties[/blue] have [blue]Defaults[/blue] that [purple]can only be permanently changed in design view by saving.[/purple] At run time your simply updating the default. Thats why when you close & open the form the defaults take over again.

So you need to:
[ol][li]Open the form in [blue]design view[/blue] in your code.[/li]
[li]Make your changes.[/li]
[li][blue]Save & Close[/blue] the form.[/li][/ol]
[purple]That is if you want the changes permament . . .[/purple]

Calvin.gif
See Ya! . . . . . .
 
thanks Guys.

yes, the control as numbers as they link back to a table (eg, click on a control and it will display the contents of a box).

A fellow worker also suggest just moving the above code in to the onload procedure and this is what I have done.
 
Small point jnrdavo, you appeared to have used a "With Statement" rather redundantly.

It's purpose is to abbreviate code, ...make it easier to read.

You included it, but didn't take advantage of it?

It should be....

With Ctrl

If .Name > 1 And .Name < 27 Then

.ControlTipText = "TEST " & .Caption


End If

End With


...just for the record!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top