Author Topic: Testing for control type  (Read 3192 times)

0 Members and 1 Guest are viewing this topic.

Columbia

  • Guest
Testing for control type
« on: November 24, 2004, 11:30:55 AM »
Is there anyway to test for what control type I pass to a variable?

As in this pseudocode:  

1.) pass generic control to function as a Variant.
2.) test for type of control (i.e. textbox, button, listbox, etc...) <-my question
3.) toggle the enable property.


Any body have any ideas???

hendie

  • Guest
Testing for control type
« Reply #1 on: November 24, 2004, 11:40:27 AM »
straight from the Acad help
Code: [Select]
' Call SetTextBoxProperties procedure.
SetTextBoxProperties Me

Sub SetTextBoxProperties(frm As Form)
Dim ctl As Control

' Enumerate Controls collection.
For Each ctl In frm.Controls
' Check to see if control is text box.
If ctl.ControlType = acTextBox Then
' Set control properties.
With ctl
.SetFocus
.Enabled = True
.Height = 400
.SpecialEffect = 0
End With
End If
Next ctl
End Sub

Columbia

  • Guest
Testing for control type
« Reply #2 on: November 24, 2004, 12:00:02 PM »
Amazing what you can find in the online help docs.  Thanks, Hendie, this is just what the doctor ordered...