I have 3 labels that act as search buttons for my form (I’m aware this is weird, but I’m trying to have the buttons look appealing, and in Access’03 it’s difficult to do without this method + OnClick.
My question is: Is there anyway to have one of these labels use a KeyPress event, so when the user hits Enter – It triggers one of the buttons of my choice, considering there isn’t a default field for Labels.
Thanks!
You can’t set focus on a label but you can simulate the behaviour you’re describing by:
-creating a button with no caption
-setting the ‘backstyle’ property to transparent
-make the button slightly bigger than your label and place it on top of your label
-give the button the behaviour previously assigned to your label.
-Assign your button the appropriate tab index
Now as the user tabs through your form, your label will appear to ‘highlight’ and the user can press enter to activate it.
Hope this helps.