Solved

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

Posted on 2002-03-21
7
274 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 4

Expert Comment

by:mcix
ID: 6887153
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
ID: 6887169
I looked through Attributes, but the only thing I found useful from there was the property for allow zero length string.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6887520
see the OpenSchema method (from the Connection object).
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 51

Accepted Solution

by:
Ryan Chong earned 100 total points
ID: 6887559
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 51

Expert Comment

by:Ryan Chong
ID: 6887566
Try:

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

Expert Comment

by:Éric Moreau
ID: 7060592
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
ID: 7065684
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

763 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