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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reference Self

Status
Not open for further replies.

cranebill

IS-IT--Management
Jan 4, 2002
1,113
US
I have a textbox named Completedate. I want to have a piece of code written so that it will enter todays date when double clicked. Thats the easy part. I can change it in the event on double click and do a:

Me.Completedate = Date()

ok now there are several hundred other textboxes i need to do the same thing with so i was wondering if there was a way to reference itself instead of typing Me.Whatever each time, and instead highlight all of them at once and write the code for all of them at once instead of each individual one?

Bill
 
Try adding an "X" to Tag property of the controls you want the dates updated in, then add the following to a command button:

Dim currctl As Integer, numctls As Integer
Dim ctl As Control

numctls = Screen.ActiveForm.Count

For currctl = 0 To numctls - 1
Set ctl = Me(currctl)
' Check the status of Controls with the Validate Tag
If ctl.Tag = "X" Then
'Do something here
Exit Sub
Else go to 10
End If

10 Next currctl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top