C
CompleteNewb
Hi all. After some useless experimentation, here I am AGAIN. I swear,
every time I think I'll be able to work my way through something, I get
NOwhere.
I'm using Access 2003 SP2 on a Windows XP Home OS.
I have a form with several hundred textboxes on it. They are currently
unbound, but will eventually be bound, I think, depending on whether I can
do what I'm trying to do right now.
I have 1 specific textbox (named "checker" in its properties), and upon
clicking a button, I want to cycle through all the other textboxes, and if
the 2 leftmost characters in the box are the same as the 2 leftmost
characters in checker, I want to turn that textbox's back color to black.
I tried doing a For Each, as below:
Dim txtbx As TextBox
For Each txtbx In Me
If Left(txtbx.Value, 2) = Left(Me.checker.Value, 2) Then
txtbx.BackColor = black
Else
txtbx.BackColor = white
End If
Next txtbx
This actually turns all of the textboxes black, regardless of their values
as they compare to checker's values, then ends with a type mismatch. I
thought using .text instead of .value would fix the type mismatch, but then
I get a "can't refer to a property of a control unless it has the focus"
error, without anything changing color.
I can't figure out why everyhting would turn black, even if the 2 left
characters DON'T match what's in checker, and then I also don't understand
why I'd get a type mismatch (they're all just unbound textboxes, and like I
said, I tried using .text instead of .value, but that obviously was even
worse).
Can anyone tell me how I can do this?
Any help appreciated, and thanks for taking the time to read and (hopefully)
help.
every time I think I'll be able to work my way through something, I get
NOwhere.
I'm using Access 2003 SP2 on a Windows XP Home OS.
I have a form with several hundred textboxes on it. They are currently
unbound, but will eventually be bound, I think, depending on whether I can
do what I'm trying to do right now.
I have 1 specific textbox (named "checker" in its properties), and upon
clicking a button, I want to cycle through all the other textboxes, and if
the 2 leftmost characters in the box are the same as the 2 leftmost
characters in checker, I want to turn that textbox's back color to black.
I tried doing a For Each, as below:
Dim txtbx As TextBox
For Each txtbx In Me
If Left(txtbx.Value, 2) = Left(Me.checker.Value, 2) Then
txtbx.BackColor = black
Else
txtbx.BackColor = white
End If
Next txtbx
This actually turns all of the textboxes black, regardless of their values
as they compare to checker's values, then ends with a type mismatch. I
thought using .text instead of .value would fix the type mismatch, but then
I get a "can't refer to a property of a control unless it has the focus"
error, without anything changing color.
I can't figure out why everyhting would turn black, even if the 2 left
characters DON'T match what's in checker, and then I also don't understand
why I'd get a type mismatch (they're all just unbound textboxes, and like I
said, I tried using .text instead of .value, but that obviously was even
worse).
Can anyone tell me how I can do this?
Any help appreciated, and thanks for taking the time to read and (hopefully)
help.