Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2002
    Location
    Illinois
    Posts
    133

    Unanswered: Change field names with VBA

    I have several tables in which field names have a prefix. Ex. HIST_NAME, HIST_ADDR. I want to remove the prefix with VBA. What is the code to reference the field name in a table? How would I cycle through all the fields in a table?

    Steve
    SteveH

  2. #2
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    Code:
    Dim Tbl As TableDef, Fld
    
    Set Tbl = CurrentDb.TableDefs("Table Name Here")
    
    For Each Fld in Tbl.Fields
        Fld.Name = ......
        .
        .
        .
    Next Fld
    I'm not sure if it's even doable in VBA, but if it is, there's the basic loop code.

    HTH,
    Sam

  3. #3
    Join Date
    Apr 2002
    Location
    Illinois
    Posts
    133
    Worked great. Thanks.

    Steve
    SteveH

  4. #4
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    I'm surprised. Really, it worked!

    You're very welcome.

    Sam

Posting Permissions

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