The following code is only for testing the usage of control variable. I want to use set statement to assign the textbox object reference to the varialbe myControl.
When I clicked the button, the system always tells me 'the object reference missing'. It seems the set statement doesn't work, but I don;t know the reason. could anyone of you please spot it out for me?
Many thanks
Option Compare Database
Public myControl As control
Public frm As Form
Set frm = Forms!Form1
Sub Command4_Click()
Set myControl = frm!Text0
myControl.SetFocus
End Sub
Sub Command5_Click()
Set myControl = frm!Text2
myControl.SetFocus
End Sub
When I clicked the button, the system always tells me 'the object reference missing'. It seems the set statement doesn't work, but I don;t know the reason. could anyone of you please spot it out for me?
Many thanks
Option Compare Database
Public myControl As control
Public frm As Form
Set frm = Forms!Form1
Sub Command4_Click()
Set myControl = frm!Text0
myControl.SetFocus
End Sub
Sub Command5_Click()
Set myControl = frm!Text2
myControl.SetFocus
End Sub