Solved

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

Posted on 2002-03-21
7
275 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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
LVL 52

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 52

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

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!

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
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…

751 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