Check box colouring option

hooby1

Registered User.
Local time
Today, 12:33
Joined
May 9, 2004
Messages
48
Hello all.
Is it possible for a check box within a subform to make that entire row turn into one colour when selected true? What I want is when the check box is selected (True) that one row and the rest of the row turns into a colour e.g. red and become disabled? Any ideas?
Cheers
 
I'm assuming tat you're using a datasheet subform, with a unique ID for each row which is on the subform, hidden or visible, but bound.

On the subform header or footer have a hidden control, txtCurrentID. On the subform OnCurrent event, store the current record unique ID in txtCurrentID.
All actual subform data controls should have a transparent backgrounds.

Underneath the record controls have a visible text box (named "txtbox") and using the Format | Conditional Formating menu for "txtbox", set the 1st condition to be [UniqueID] = [txtCurrentID], the Forecolor and Backcolor to the color of your choice, the default Forecolor and Backcolor of "txtbox" should also be set to some color, probably White or Grey.

I hope that this is clear.
 
Hello.
Cheers for the reply. Looked at your reply but Im confused a bit. Using a form and a subform within it. On the subform there is a check box column which, when this is not ticked the whole row that the checkbox is on including the checkbox changes to a different colour e.g.
Column Column Column

Paid(Y/N) Name Comment
UNTICKED Mr A None (This row in the subform changes colour)
TICKED Mr A None (This row stays white)

Hope you can help?
Cheers
 
The attached zipped A2K mdb has a couple form examples.

See form frmMain particularily. Note the following withrespect to the subform on that form:

1. textbox "text7" is a backgroud textbox. Note its
a. TabStop and Cycle properties, and
b. GotFocus event. It can be inadvertently clicked; if so, focus is changed to sName.
2. The Conditional Formatting of each of the textboxes.
3. The Gotfocus event of the checkbox - it changes the checkbox's label's color.
 

Attachments

Cheers for the reply.
This is helpful.
How would you go about this in A97?
 
A97, of course, doesn't have conditional formatting.

I recall that I once had a form similar to my example with an analogous "text7" control.

On the OnCurrent

If fTicked = true then
me!text7.backcolor = vbBlue
else
me!text7.backcolor = vbWhite
end if

I'm not guaranteeing it, but think that it'll work.

I thin k that I got the solution from the Access Cookbook, 1st Edition, authored by Ken Getz, et al., published by O'Reilly. There's a 2nd Edition and I'm not sure that it has the solution.

I converted my development from A97 to A2K solely because of the availability of Conditiopnal Formatting in A2K and later.
 
Hi,
Thanks for quick reply. Had a go at but it didn't seem to work. The box went blue but the check box wasn't ticked. When you then click the check box it stayed on blue. I think there is an error or something could you show another example with a sub form? It's as a datasheet.
Cheers
 
You also have to test on the checkbox AfterUpdate event as well as the subform OnCurrent event.
 
Hello,
Cheers for the reply. What about if the subform is set as a datasheet view this doesn't seem to work.When you select the checkbox nothing changes colour. If changed to a form view this works but every check box changes colour and the textboxes, instead of only the single line the check box is on.
Hope you can help. This would be good if this works on a datasheet view.
Cheers
 
For checkoxes, I change the color/backstyle of the associated label in the header section of the form on the checkbox' GotFocus event, then change it/them again on the checkbox' LostFocus event. The fewer the rows you display, the more evidnet it is. I also not the effect in my user documentation.

Of course, checkboxes themselves are not colorable; at least I've not found a way.
 

Users who are viewing this thread

Back
Top Bottom