well thanks , i have not seen CreateControl before but it appears to only make a control at design time.
i have used code like this :
Dim objEvents As New Collection
Dim objNew As clsBtn 'clsBtn is the nam of the class
Set objNew = New clsBtn
Set objNew.objTxt = frmData.Controls.Add("Forms.TextBox.1")
With objNew.objTxt
'etc
objEvents.Add objNew
'etc
but this is for a user form (in Word) and would like to do the same in Access.
well i wish to have a command button on the form so that when i press it a new text box appears. (I don't want to workaround using a visible true/false.)
Setting visible true / false is not generally considered to be a 'work-around'. Adding controls at run-time is problematical, to say the least; if you take this path you will not be able to make an mde to protect your code, to mention just one problem. I suggest you use visible true / false.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.