John Colby
jwcolby at gmail.com
Thu Feb 7 13:08:42 CST 2013
I never received this back from AccessD so I do not know if it was ever received by you guys. If so just read it again. ;) The code for the form's class is simple. In the form's header we create an instance of the class for every text box we want to handle. Notice that I already have a disclaimer that this is the 'quick and dirty' way of doing things. This works but there is a better way which we will discuss once you have absorbed this method. ' 'The quick and dirty way to do this ' Private cDNDTxt2 As clsDNDText Private cDNDTxt4 As clsDNDText Private cDNDTxt6 As clsDNDText In the form's Open event we initialize each of the instances of this class, setting the pointer to each instance using the new keyword and then passing in a pointer to one of the text boxes in the mInit method. Private Sub Form_Open(Cancel As Integer) Set cDNDTxt2 = New clsDNDText cDNDTxt2.mInit Text2 Set cDNDTxt4 = New clsDNDText cDNDTxt4.mInit Text4 Set cDNDTxt6 = New clsDNDText cDNDTxt6.mInit Text6 End Sub and finally, not included in the original post we want to cleanup in the form's close event Private Sub Form_Close() Set cDNDTxt2 = Nothing Set cDNDTxt4 = Nothing Set cDNDTxt6 = Nothing End Sub How much simpler can it be? Let's discuss this and then we can move on to the next step. -- John W. Colby Colby Consulting