intrinsic constants

M

Miaplacidus

I have a statement that returns the value of an intrinsic
constant for a ControlType. It returns the value as an
integer ie 110 if the control is a listbox. How can I get
it to return the value as acListBox, which I'm more likely
to understand?
 
A

Allen Browne

Try passing the result of the ControlType into this function, e.g.:
? ControlTypeName(Me.Text0.ControlType)


Function ControlTypeName(n As Long) As String
'Purpose: Return the name of the ControlType.
'Note: The ControlType returns a Byte, but the constants are Long.
Dim strReturn As String

Select Case n
Case acBoundObjectFrame
strReturn = "Bound Object Frame"
Case acCheckBox
strReturn = "Check Box"
Case acComboBox
strReturn = "Combo Box"
Case acCommandButton
strReturn = "Command Button"
Case acCustomControl
strReturn = "Custom Control"
Case acImage
strReturn = "Image"
Case acLabel
strReturn = "Label"
Case acLine
strReturn = "Line"
Case acListBox
strReturn = "List Box"
Case acObjectFrame
strReturn = "Object Frame"
Case acOptionButton
strReturn = "Object Button"
Case acOptionGroup
strReturn = "Option Group"
Case acPage
strReturn = "Page (of Tab)"
Case acPageBreak
strReturn = "Page Break"
Case acRectangle
strReturn = "Rectangle"
Case acSubform
strReturn = "Subform/Subrport"
Case acTabCtl
strReturn = "Tab Control"
Case acTextBox
strReturn = "Text Box"
Case acToggleButton
strReturn = "Toggle Button"
Case Else
strReturn = "Unknown: type" & n
End Select
ControlTypeName = strReturn
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top