Button won't unselect.

PuddinPie

Registered User.
Local time
Yesterday, 18:50
Joined
Sep 15, 2010
Messages
149
I'm using Access 97 and I have a form with a button that increments a text field by one everytime it's pressed. The issue I am having is that when you click on it it stays hilighted and wont go back to it's normal colour.
Here's the code I am using:

Private Sub lblTrxType9_Click()
Me![TrxType9] = [TrxType9] + 1
Me![TrxType9].ForeColor = 0
End Sub

Have a good day.
 
That is because it still has the focus. You need to move the focus to another object but you will also have to use the On Lost Focus event to reset the properties of the button you modified.
 
OK. I get that but how would the code look?
 
I tryed CommandButton1.SetFocus on the on click and it does set the focus to the submit button but the original button stays hilighted. I'm still not quite sute what to do codeing wise. Please help.
 
To set focus to a control, prefix it with the keyword Me

Me.Commandbutton1.SetFocus

which is shorthand for:

Form!NameOfForm!Comandbutton.SetFocus

JR
 

Users who are viewing this thread

Back
Top Bottom