Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Control Arrays in Access? 1

Status
Not open for further replies.

combs

Programmer
Apr 18, 2002
78
US
I have several (25) textboxes on a form. I would like to write code that will fire on an AfterUpdate event. (i.e. when a value changes in the text box and the user moves focus to another text box).

Is there a way besides writting 25 seperate subs to do this for all 25 text boxes? I have copied the code from a single text box below:


Code:
Private Sub QTD1_AfterUpdate()
    MsgBox "AfterUpdate Event..."
End Sub

All the text boxes follow the same naming scheme from QTD1 to QTD25. Also, there are several columns (8) of the 25 text boxes on this form (all are uniquely named).

Any help or suggestions would be greatly appreciated.
 
Shift Select all of your fields and in the AfterUpdate Property enter something like =MyAfterUpdate().

Function MyAfterUpdate()

Dim ctl as Control

Set ctl = Screen.ActiveControl

MsgBox ctl.name

End Function
 
FancyPrairie -

Thanks so much for that tip! It works beautifully!

Am I just a slow learner or is that type of control behaviour not documented especially well??

Anyway, that was exactly what I was looking for!

Star for you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top