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

Multi-edit fields on a form

Status
Not open for further replies.

gibblin

Technical User
Oct 9, 2003
27
GB
If i have several fields on a form named, for example, Text1, Text2, Text3 and Text4, how can i multi-edit the backcolor of those fields?

I don't want to go through each individually like follows:-
If IsNull(Text1)= false then
Text1.backcolour = 255
End if
If IsNull(Text2)= false then
Text2.backcolour = 255
End if

...etc etc...obviously if i have many fields this will become a pain.

surely there's some code that will go through all the fields and alter them in one go??

I'm sure this will be easy for someone. Do i use a for..next statement or loop, any help would be appreciated.
 
A starting point:
For i = 1 To 4
If Trim(Me("Text" & i) & "") > "" Then
Me("Text" & i).BackColour = 255
End If
Next i

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Exactly what i was looking for, tried a similar method myself to no avail,obviously it needed a few tweeks.

Thank you very much.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top