Results 1 to 12 of 12
  1. #1
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Setting Table Description in VBA (2000/2002 SR2)

    <img src=/S/brickwall.gif border=0 alt=brickwall width=25 height=15> OK, I give up! I've looked everywhere, and can't find any documentation on how to set the Description property for a table in code (DAO). Has one of you out there found a way to do that - I found almost everything but.
    Wendell

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Setting Table Description in VBA (2000/2002 SR2)

    Try something like this:

    Sub SetDescription(sTableName As String, sDescription As String)
    Dim dbs As DAO.Database
    Dim tdf As DAO.TableDef
    Dim prp As DAO.Property

    Set dbs = CurrentDb
    Set tdf = dbs.TableDefs(sTableName)

    On Error GoTo Err_Handler

    Set prp = tdf.Properties("Description")
    prp.Value = sDescription
    Exit Sub

    Err_Handler:

    ' Create Description property with dummy value
    Set prp = tdf.CreateProperty("Description", dbText, " ")
    tdf.Properties.Append prp
    Resume Next

    End Sub

  3. #3
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Setting Table Description in VBA (2000/2002 SR2)

    Thanks Hans, I finally managed to get similar info out of the MS KB - it wasn't working for a while this morning. That should get me going.
    Wendell

  4. #4
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Setting Table Description in VBA (2000/2002 SR2)

    Wendell,

    At the risk of sounding like an ad....

    If you want to know how to Add, Edit or Delete Tables, Fields, Indexes or Relationships in code have a look at a <img src=/S/free.gif border=0 alt=free width=30 height=15> "products" put out by Database Advisors called BackEnd Upgrader.

    The jist of it is: it allows you to create a "list" of BE mods that get applied the first time a new FE is distributed. All of it is done with DAO.

    Yes, I did have a hand in developing this. Right now were are in the Alpha Stage of Version 2. Integrating it with Jet Security.
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Setting Table Description in VBA (2000/2002 SR2)

    Yep, you sound like an ad, Bryan. Ixnay on the adyay.
    Charlotte

  6. #6
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Setting Table Description in VBA (2000/2002 SR2)

    It wasn't an issue of knowing how to deal with things like TableDefs, it was that fact that nowhere in the Help? files (or in the MS KB) does it tell you that the Description property is not part of the attributes, but is a standalone property of each table. But thanks for pointing out the tool - I'll take a look at it even if Charlotte thinks its an ad!
    Wendell

  7. #7
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Setting Table Description in VBA (2000/2002 SR2)

    You have to understand, Wendell, that I'm part of the list that is beating up on Bryan and the tool in question. <img src=/S/sneaky.gif border=0 alt=sneaky width=15 height=15> I just forgot to put a smilie into my response to him.
    Charlotte

  8. #8
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Setting Table Description in VBA (2000/2002 SR2)

    I sort of got that impression from your response - <img src=/S/cranky.gif border=0 alt=cranky width=18 height=25> and <img src=/S/devil.gif border=0 alt=devil width=15 height=15>ish at the same time!
    Wendell

  9. #9
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Setting Table Description in VBA (2000/2002 SR2)

    Moi?? <img src=/S/shocked.gif border=0 alt=shocked width=15 height=15>
    Charlotte

  10. #10
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Setting Table Description in VBA (2000/2002 SR2)

    Yes you !! Well who stole the cookie from the cookie jar ??

  11. #11
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Setting Table Description in VBA (2000/2002 SR2)

    Sorry Charlotte <img src=/S/sad.gif border=0 alt=sad width=15 height=15> It was not intentional.

    Let's <img src=/S/kiss.gif border=0 alt=kiss width=34 height=15> and make up.
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

  12. #12
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Setting Table Description in VBA (2000/2002 SR2)

    Yea, but aren't there a ton of things that the non-Help files don't tell us?

    That's why forums like this are chock full of folks looking for help.

    That and the point I entirely missed was that the "other" program (down in my sig) has had developers bashing at Access to get a list of what can be and can't be changed through code, and how to change it it code if it can be.
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

Posting Permissions

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