Murray Brown
asked on
Access VBA Error trying to create column for linked table
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
Next
If Not blnFieldExists Then
Set fld = tdf.CreateField("CreatedDT G", dbDate)
fld.DefaultValue = "=Now()"
tdf.Fields.Append fld
End If
End Sub
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
Next
If Not blnFieldExists Then
Set fld = tdf.CreateField("CreatedDT
fld.DefaultValue = "=Now()"
tdf.Fields.Append fld
End If
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER