Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2002
    Posts
    17

    Question Unanswered: how to a add a field to a linked table?

    G'day everyone,

    I have a table that's got several fields that are used to link to other tables. Now I want to add a new field but table properties cannot be modified as the table is linked.
    What is the way to add new fields to linked tables? Thanks for any help
    Ali G is da best

  2. #2
    Join Date
    Apr 2002
    Location
    Portugal
    Posts
    146
    Hi!

    When you say "Several fields linked...", do yu ment "Related.."!?

    If so, you're abble to add or remove fields freely, of course not the related ones.

    If you're using a linked database, then you must add or remove fields in the original tables and not the linked ones. Certainly you've noticed a kind of message when you open a linked table in design view: "...You can not Add or change values...on linked tables...", therefore you change the values and fields in the original database.

    Hope being helpfull!

  3. #3
    Join Date
    Jul 2003
    Posts
    1
    Originally posted by Miguel
    Hi!

    When you say "Several fields linked...", do yu ment "Related.."!?

    If so, you're abble to add or remove fields freely, of course not the related ones.

    If you're using a linked database, then you must add or remove fields in the original tables and not the linked ones. Certainly you've noticed a kind of message when you open a linked table in design view: "...You can not Add or change values...on linked tables...", therefore you change the values and fields in the original database.

    Hope being helpfull!
    Can you please tell me what do you mean by "original database"?

  4. #4
    Join Date
    Jul 2003
    Posts
    38
    Assuming your problem is, that you linked a table from a backend DB to a frontend DB and now you want to add a column to that table, then the solution is only VBA. You can't do it with SQL or even the Access GUI.

    Miguel meant, you should open the backend db to alter the table.

    The VBA code for adding a field to a table is like this:

    private sub AddField
    dim db as dao.database
    dim td as dao.tabledef

    set db=OpenDatabase([PathToDatabase], , False, "MS Acess;")
    set td=db.tabledefs([Tablename])
    td.Fields.Append td.CreateField([FieldName], dbText, 200)

    end sub

    You have to add a link to DAO 3.6
    Hope this was helpful and had not too many errors

Posting Permissions

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