Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    387
    Thanks
    0
    Thanked 1 Time in 1 Post

    adding fields in code (DAO)

    The following code works if I am creating a new table but if the table does exist it does not add the field.

    Set tblNewTable = dbDatabase.CreateTableDef(strTableName)
    Set fldNewField = tblNewTable.CreateField(strFieldName, dbDouble)
    tblNewTable.Fields.Append fldNewField
    dbDatabase.TableDefs.Append tblNewTable

    How do get the new field to append into the tabledef if the table already exists?

  2. #2
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    387
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: adding fields in code (DAO)

    I worked it out
    Set tblNewTable = dbDatabase.TableDefs(strTableName)
    instead of
    Set tblNewTable = dbDatabase.CreateTableDef(strTableName)

Posting Permissions

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