-
Hello,
I've an application, which set several controls on the form at runtime.
Now I want to put the value of the controls into a recordset. The problem is that I don't now what sort of control I'm retrieving the data from.
For instance:
With a simple textbox you can retrieve the data by object.TEXT,
but with a checkbox for instance it is object.VALUE
How can I get the type of the control, which contains the data?
Thanks
-
I had the same problem.
You can use :
Select Case TypeName(Screen.ActiveForm.Controls(X))
Case "TextBox", "MaskEdBox"
' your code
Case "CheckBox"
' your code
End Select
-
Also check out TypeOf
Code:
Private Sub CheckControl(ctrl As Control)
Dim ctrl As Control
Msgbox TypeOf ctrl Is CheckBox
Msgbox TypeOf ctrl Is TextBox
End Sub
-
Hey JOP, thanks for helping me out.
I found the code must easier then that from iring