Some checkboxes "highlight" label and some do not?

J

Jason

Hi,

I have a form with several checkboxes on it (and other controls like text
boxes, option buttons, etc). When Tabbing through the fields it is hard to
tell when you are on some of the checkboxes. Some of them "highlight" their
attached label with a little dotted box around the label and some do not. I
have tried to compare the properties of both (checkbox and label) to see
where they are different but they all appear to be the same except for the
obvious things like the actual name or size of size of the controls. Is
there some specific property that controls this that I just missed?
Thanks
 
T

tina

AFAIK, no. to make it easier to see which control is selected in a form, i
usually change the ForeColor property of the label of the active control -
using the following code. you can paste it into a standard module, and if
you create a new standard module to hold it, make sure you don't name the
module the same name as the function. you can add the code directly to the
OnEnter and OnExit event property lines of each control in a form, as noted
in the function comments.

Public Function isSelected(ByVal lngColor As Long)

' change the active control's label, or the active command button,
' to a different color.
' use directly in the control's OnEnter and OnExit properties,
' as "=isSelected(ColorCodeAsNumber)"
' but *don't* include the double quotes.

On Error GoTo isSelected_Err

Dim ctlObject As Control

With CodeContextObject
For Each ctlObject In .Controls
If TypeOf ctlObject Is Label Then
If ctlObject.Parent.Name = Screen.ActiveControl.Name Then
ctlObject.ForeColor = lngColor
Exit For
End If
End If
Next ctlObject
End With

isSelected_Exit:
Exit Function

isSelected_Err:
Select Case err.Number
' Err.Description = "The expression you entered requires the control to
be
' in the active window."
Case 2474
Resume isSelected_Exit
Case Else
MsgBox err.Number & " " & err.Description, , "Public:
isSelected()"
Resume isSelected_Exit
End Select

End Function

btw, the code has no effect on a form in Datasheet view; also, suggest you
only use it on a form in Single Form view, not Continuous Form view.

hth
 
J

Jason W

Thanks for the suggestion Tina.

Does not exactly solve the problem but is another possible way of doing
things. Actually it is a very elegant way of doing things. Of course
this entails going back to hundreds of fields and dozens of forms and
doing something to all of them. And a great many of them have other code
(especially in the OnExit) that does a variety of validations on the
data and controls data flow in many cases which kind of precludes a
simple replace all via the editor. But if I can sell them this as an
upgrade that might mask the issue and would look better over all. It
does look slick.

BTW there is a routine in the book Access Hacks, (Hack #27) which does
something similar for Controls. It is a little limited and needs more
work to look better and work with more than textboxes. It just changes
the Border Properties but can be used to change other things the same way.

Of course I still have the issue with some of the checkboxes having
"highlights" and some not. I have tried to find other common (or not
common) things with them like being inside Boxes drawn on the form vs
just on the form, having events vs no events, etc. It seems likely there
is something in common with those that are not working the same but I
don't see it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top