[AccessD] Alter table

Steve Schapel miscellany at mvps.org
Tue Feb 26 13:53:05 CST 2008


John,

I would more often not use DDL, because there are some things youcan't 
do, such as modify field properties.  Therefore, this would be another 
possible approach:

    Dim dbs As Database
    Dim tdf As DAO.TableDef
    Set dbs = OpenDatabase("<your backend>")
    Set tdf = dbs.TableDefs("YourTable")
       With tdf
          .Fields.Append .CreateField("SomeField", dbText, 10)
          .Fields("SomeField").AllowZeroLength = False
          .Fields("SomeField").DefaultValue = "fred"
       End With
    dbs.Close
    Set tdf = Nothing
    Set dbs = Nothing

Regards
Steve

jwcolby wrote:
> That was my next thing to try.
> 



More information about the AccessD mailing list