• adding fields in code (DAO)

    Author
    Topic
    #435042

    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?

    Viewing 0 reply threads
    Author
    Replies
    • #1027196

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

    Viewing 0 reply threads
    Reply To: adding fields in code (DAO)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: