Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2002
    Location
    Mpls/St.Paul area
    Posts
    303

    Unanswered: Read MS Access Table Properties using VBA

    I would like to read the description property for every object in my access database programmatically. I am befuddled in attempting to get at the description.

    I use the description field (accessed through properties) to write versions on objects. I would like to collect it all as text. But I cannot get to the description property when I try looping through collections of documents.

    Sample desired output.
    Object Name, Description, Modified, Created, Type
    tblOne Version 1.1 3/3/07 02/02/04 Table:Linked ODBC
    tblTwo Version 1.1 3/1/07 02/15/04 Table:Linked ODBC
    tblEtc. Version 1.2 3/6/07 02/07/04 Table

    Basically I want to collect the info that is visible from the detailed view of the database window.
    John
    This is the day the Lord has made, I will rejoice and be glad in it.

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi John.

    I have not tried these but:
    Have you tried using the properties collection of the object?
    Have you tried accessing via a DAO tabledef object?

    BTW - in case you are interested this sort of thing I like to pop into a data dictionary - that way it is more transparent and less propeitry (and therefore more portable). And, on a more practical level, easier to get the info.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    OK- idea #1 works. Quick and dirty:
    Code:
    Sub gettdesc()
     
        Dim o As Object
        Dim p As Property
        Dim db As DAO.Database
     
        Set db = Application.CurrentDb
     
        Set o = db.Containers("tables").Documents("myTable")
     
        On Error Resume Next
     
        For Each p In o.Properties
     
            Debug.Print p.Name & vbTab & vbTab & p.Value
     
        Next p
     
        Set o = Nothing
        Set db = Nothing
     
    End Sub
    Testimonial:
    pootle flump
    ur codings are working excelent.

  4. #4
    Join Date
    Jun 2002
    Location
    Mpls/St.Paul area
    Posts
    303
    Nicely done.

    Syntax is a killer(bang bang)

    My goal is to automagically list all the tables, and forms, and reports, etc (of which there are hundreds). While I'm at it, I thought I would grab the version numbers for my objects which I saved as the description.

    Thank you for your help!
    Last edited by jpshay; 07-26-07 at 09:47.

  5. #5
    Join Date
    Nov 2011
    Posts
    1
    Strange, this does not work, the code finds the table but-

    I only get:
    p.name = "Object variable or With block variable not set"

    Access 2007, macro settings low.

    I have tried several posts and none appear to list properties of table.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •