textfield in a loop

  • Thread starter Thread starter Jean-Paul
  • Start date Start date
J

Jean-Paul

Hi

I have following code:

If IsNull(Me!Tekst93) = False Then
Me!Tekst93.BackColor = 10996145
End If

I need this code for about 150 textfields: from 93 to 241
Is there a way to create a loop so I don't have to write almost the sae
code for 15 textfields?

Thanks
 
I can only set it to higher or lower or equal...
No isnull=true or false
or am I wrong?
JP
 
Perfect... thanks

But, now I have to set it for all 150 fields
Something I would not have to do in my loop

JP
 
Hmmm, I thought it was a column, my mistake. I never tried to set
formatting like that across fields, would remind me of a spreadsheet. That
being said when I get back from dropping off my car let me see if I can dig
something up OR hang on a bit someone might have some air code they will
post and you could play with...

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index.htm

Jean-Paul said:
Perfect... thanks

But, now I have to set it for all 150 fields
Something I would not have to do in my loop

JP

Gina said:
Use the "Expression Is", then you should be able to use IsNull([Tekst93])
and then select a backcolor.
 
I did find this...

While not what EXACTLY what you looking for if the fields all start the same
way you might be able to adapt. Also note, the Label is actually a text box.
rtw 9.18.2006

Public Function ClearViolation()

Dim LabelNumber As Long

LabelNumber = 1

Dim Msg, Style, Title, Response, MyString


Msg = "Did you want to change this Violation?"

Style = vbYesNo + vbQuestion + vbDefaultButton2

Title = "Violation Type"

Response = MsgBox(Msg, Style, Title)

If Response = vbYes Then

MyString = "Yes"

Do Until LabelNumber = 9

Me("txt" & LabelNumber & "Label") = ""

Me("txt" & LabelNumber & "Label").Locked = False

Me("txt" & LabelNumber & "Label").BackColor = 13303807

LabelNumber = LabelNumber + 1

Loop

Else

MyString = "No"

End If

End Function


--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index.htm

Gina Whipp said:
Use the "Expression Is", then you should be able to use IsNull([Tekst93])
and then select a backcolor.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index.htm

Jean-Paul said:
I can only set it to higher or lower or equal...
No isnull=true or false
or am I wrong?
JP
 
That's just what I needed.... works perfect, saved me about an hour
programming
Thanks
 
Back
Top