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!

create button and add an event

Status
Not open for further replies.

matrixindicator

IS-IT--Management
Sep 6, 2007
418
BE
I create my buttons and forms with vba. I wonder if you can even add an event and some code on it ?

Code:
OwnControl.Caption = rst!plantnl 
OwnControl.ForeColor = white = not working.
OwnControl.Name = rst!IDPL
 
sure u can :

OwnControl.OnClick = "= ... your command here ...
 
Yeah I found this also but strugling with the code.

It seems he accept a macro. In this macro I refer to a procedure testfunct (ctl1.name)
In a textbox he should show onclick for each button the number of te bottum (is also an article ID).
But how to say take the name of the this control (button)
If I click on button1 he shows this in the textbox.
The name of the control is in this case 1.
Now I am obliged to say ctl1.name. Could I not say the button where you are on (and not ctl1, ctl2, ctt3,...

Code:
Function testfunct(ctl1 As String) = ctl1 is working not ctl
Forms![14]!txtIDART = ctl

End Function

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top