For the TEXT boxes, you have two events that you might consider using. They are the ON ENTER and ON EXIT events.
Example:
On a form, you have an OPTION FRAME (buttons, checkboxes, whatever) named OPTION_BOX and it has two choices.
OPTION_BOX
+-----------------------+
| O Box 1 was selected | <-- Option Value = 1
| O Box 2 was selected | <-- Option Value = 2
+-----------------------+
Then you have three (3) Text boxes named BOX1, BOX2 and BOX3
+-----------+
| | This is BOX1
+-----------+
+-----------+
| | This is BOX2
+-----------+
+-----------+
| | This is BOX3
+-----------+
The following VBA code will set the value of the OPTION_BOX to 1 if the user clicks in the Text Box named BOX1. It will set the value of OPTION_BOX to 2 when the user clicks in the Text Box named BOX2.
Just for cleanup, and to to illustrate the ON EXIT property, if the user clicks in Text Box 3 (or anywhere else for that matter), the value of OPTION_BOX resorts to null. (You might want to have a default or otherwise control for this).
' HERE IS THE VBA CODE FOR THE ABOVE EXAMPLE
Private Sub BOX1_Enter()
Me.OPTION_BOX = 1
End Sub
Private Sub BOX1_Exit(Cancel As Integer)
Me.OPTION_BOX = Null
End Sub
Private Sub BOX2_Enter()
Me.OPTION_BOX = 2
End Sub
Private Sub BOX2_Exit(Cancel As Integer)
Me.OPTION_BOX = Null
End Sub
I hope this helps.
Alan J. Volkert
Fleet Services
GE Commercial Finance Capital Solutions
(World's longest company title)
Eden Prairie, MN