Solved

How to read a MSAccess Field's Properties via ADO 2.5

Posted on 2002-03-21
7
270 Views
Last Modified: 2007-12-19
Is it possible to read the Caption property and Validate Text property of a MSAccess 2000 table's field through ADO 2.5? I looked through the properties and couldn't find it. I recently switched from DAO to ADO and am still getting used to the features.

The reason I need this ability is that I wanted to populate my tooltips and validation messages from these properties.

Thanks.
0
Comment
Question by:rbohn
7 Comments
 
LVL 4

Expert Comment

by:mcix
Comment Utility
You might have a look at the ADODB.Field.Attributes Collection.

Might be there, but I kind of doubt it...
0
 

Author Comment

by:rbohn
Comment Utility
I looked through Attributes, but the only thing I found useful from there was the property for allow zero length string.
0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
see the OpenSchema method (from the Connection object).
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 49

Accepted Solution

by:
Ryan Chong earned 100 total points
Comment Utility
Hi rbohn,

This example use ADOX to get the properties of fields and display it into a ListView Control:

Private Sub showFieldNameADO(ByVal DBFullPath As String, ByVal sTable As String)
    'On Error GoTo ErrorHandler
   
    Dim oCat As ADOX.Catalog
    Dim oTable As ADOX.Table
   
    ListView1.ListItems.Clear
   
    Set oCat = New ADOX.Catalog
    oCat.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
                            "Data Source=" & DBFullPath & ";"
   
    For Each oTable In oCat.Tables
        If UCase(oTable.Name) = UCase(sTable) Then
            For i = 0 To oTable.Columns.Count - 1
                ListView1.ListItems.Add i + 1, , oTable.Columns(i).Name
                ListView1.ListItems(i + 1).SubItems(1) = GetDataTypeString(oTable.Columns(i).Type)
                ListView1.ListItems(i + 1).SubItems(2) = oTable.Columns(i).DefinedSize
                ListView1.ListItems(i + 1).SubItems(3) = oTable.Columns(i).Properties(2).Value
            Next i
        End If
    Next
   
    Set oTable = Nothing
    Set oCat = Nothing
   
    Exit Sub
ErrorHandler:
    MsgBox Err.Number & ": " & Err.Description
End Sub

Basically use: oTable.Columns(i).Properties(N).Value to get the property value

Hope this help
0
 
LVL 49

Expert Comment

by:Ryan Chong
Comment Utility
Try:

oTable.Columns(i).Properties("Jet OLEDB:Allow Zero Length").Value to get the Value.
0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
This question appears to be abandoned. A question regarding it will be left in the Community Support
area; if you have any comment about the question, please leave it here.

Unless there is objection or further activity, one of the moderators will be asked to accept the comment
of <ryancys>.

The link to the Community Support area is:
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt

DO NOT ACCEPT THIS COMMENT AS AN ANSWER.
0
 
LVL 1

Expert Comment

by:Moondancer
Comment Utility
rbohn logged in right after you posted this request and chose not to respond, so I can only assume Asker agrees and closed this.

Thanks for your help.

Moondancer - EE Moderator
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now