Results 1 to 6 of 6

Thread: table element data types in Access

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2001
    Location
    new jersey
    Posts
    2,904

    table element data types in Access

    I need to display the data types off all elements in an Access db table. I can do it for forms but can't figure out how to do it for tables with either VB or VBA. Any suggestions? I'm using Access 2000 & VB 6.0 and don't care whether I do it inside Access w/ VBA, or externally w/ VB

    Thanks for your time

    Paul Hinds
    [email protected]

  2. #2
    Hyperactive Member
    Join Date
    Mar 2002
    Posts
    424

    Wink

    VB Code:
    1. Dim dbs As Database
    2. Dim tdf As TableDef
    3. Dim fld As Field
    4. Set dbs = CurrentDb
    5. On Error Resume Next
    6. txtResults.SetFocus
    7. txtResults.Text = ""
    8. For Each tdf In dbs.TableDefs
    9.           For Each fld In tdf.Fields
    10.                txtResults.SetFocus
    11.                txtResults.Text = fld.Name & ": " & fld.Type
    12.           Next fld
    13. Next
    14. Set dbs = Nothing

    Hope that get's you started

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Aug 2001
    Location
    new jersey
    Posts
    2,904

    configuration issue?

    Your code looks good to me and I thank you, but I seem to have a configuration problem (?) since all I get is an immediate error message complaining that "Database" is an a user defined data type that is not defined. This happens whether I put the code in Access VBA or into VB 6.0

  4. #4
    New Member Nero's Avatar
    Join Date
    Apr 2002
    Location
    Shropshire
    Posts
    14
    Have you set the references to use the 'DAO 3.6 object library'?
    If so set it to higher priority than the'Active X Data Objects library'

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Aug 2001
    Location
    new jersey
    Posts
    2,904
    outstanding !!!

    How on earth does one figure that out ? I mean, it strikes me as about as far from intuitive as you can get. I understand that "experience" is the basic answer, but the on-line help was no help at all on this one. (Unless it's one of those Microsoft specialties where it's really easy to figure out the answer provided you already know the answer so you know exactly what quesiton to ask)

    Anyway, thank you very much.

  6. #6
    New Member Nero's Avatar
    Join Date
    Apr 2002
    Location
    Shropshire
    Posts
    14

    Smile

    Glad to Help!!

Posting Permissions

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



Click Here to Expand Forum to Full Width