Continuous form checkbox & textbox
On a continuous form in Access 2000, there is a checkbox and a textbox. When I click the checkbox, I want the associated textbox to change backcolor to red. (this is actually a problem I'm trying to solve for a co-worker) However, it changes all the textboxes to red (there could be 1 - 50 check & textboxes). Of course, there's only one in design mode. The code goes like this:
Code:
if me!chkQT.checked then
me!txtQT.backcolor = lngRed
else
me!txtQT.Backcolor = lngWhite
end if
How can I get just the one textbox to change color? Thanks.
Re: Continuous form checkbox & textbox
salvelinus, I duplicated your issue and t would appear that when a form is in "Continuous" form style it creates multiple instances of the controls.
So when you change the Back Color property for the control your actually changing the parent control, so to speak. The trick will be to find a way to gain access to an indivdule instance of the textbox. I will keep looking into this and let you know what I find.
Re: Continuous form checkbox & textbox
It seems like this would be a control array issue in vb6, maybe a dynamically created one, but I don't know how to approach this in vba. My ideas had to do with setting the tag property or tabindex. This seems like it should be a no-brainer.
My co-worker believes he's found a fix using conditional formatting, but I haven't seen what he did and am unfamiliar with that in Access, only know of it in Excel.
Thanks for looking into this RobDog.
Edit:
He used conditional formatting on the Access menubar. Why it wouldn't work in code I don't know.
Re: Continuous form checkbox & textbox
Ok, I will look at CF in code.
Re: Continuous form checkbox & textbox
I am having a similar problem. I have two columns of checkboxes (really only 2 checkboxes in design view)
When one is checked I want the correspoding one to be checked to. The problem is that it only works for the first one in the column and not for all the corresponding ones.
The following is my code:
Private Sub Check21_Click()
Me.Requery
If Me.Check21 = True Then Me.Check19 = True
If Me.Check21 = False Then Me.Check19 = False
End Sub
Did you ever solve this?
Thanks!