Access VBA Error trying to create column for linked table

Murray Brown
Murray Brown used Ask the Experts™
In trying to create an Access column in a linked table I get the error "Operation is not supported in linked tables"
Is there a way to do this where the tables are linked

Sub oCheck_Add_Columns()

    Dim dbs As DAO.Database
    Dim tdf As DAO.TableDef
    Dim fld As DAO.Field
    Dim blnFieldExists As Boolean
    Set dbs = CurrentDb()
    Set tdf = dbs.TableDefs("Ammunition")
    For Each fld In tdf.Fields
        If fld.Name = "CreatedDTG" Then
            blnFieldExists = True
            Exit For
        End If
    If Not blnFieldExists Then
        Set fld = tdf.CreateField("CreatedDTG", dbDate)
        fld.DefaultValue = "=Now()"
        tdf.Fields.Append fld
    End If
End Sub
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
President / Owner CARDA Consultants Inc.
Distinguished Expert 2018
Normally, design changes are does in the back-end directly on the table itself.

If you truly want to venture down this road, then you need to get into accessing the back-end through code and then automating it.  There are different ways of doing this.  One example would be
Murray Developer


Great answer! Thanks very much Daniel

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial