Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / March 2005

Tip: Looking for answers? Try searching our database.

intrinsic constants

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Miaplacidus - 09 Sep 2004 17:44 GMT
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?
Allen Browne - 09 Sep 2004 17:52 GMT
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

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

>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?
Alan Varga - 23 Mar 2005 20:01 GMT
I'm glad to have run across this website.  There is some very good
information here.

After searching the Internet for a couple of hours, this thread seems to be
the closest to answering my question.  How, in VBA, can I supply the name
of any Enum like acColorIndex or acControlType and save the following
output to a table?

name            value
=======         =====
acOptionButton  105
acTextBox       109
etc.

Thanks, Alan
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.