[AccessD] Adding property to table field

David Emerson newsgrps at dalyn.co.nz
Thu Feb 3 23:26:15 CST 2005


Group,

A97.  Here is my code:

     Dim dbsBE As Database, tbldef As TableDef, fld As Field

     Set dbsBE = 
DBEngine.Workspaces(0).OpenDatabase(DLookup("DataDirectory", "Variables 
Setup"))

     Set tbldef = dbsBE.TableDefs("Variables")
     'create the fields
     Set fld = tbldef.CreateField("AnnualReturnCA11", dbSingle)
     tbldef.Fields.Append fld

     fld.Properties.Append fld.CreateProperty("Format", dbText, "Percent")
     fld.Properties.Append fld.CreateProperty("DecimalPlaces", dbText, "2")
     fld.Properties("DefaultValue").Value = 0

This all works except the DecimalPlaces property shows "Auto" in the table 
(and not 2).  I have tried
     fld.Properties.Append fld.CreateProperty("DecimalPlaces", dbInteger, 2)
but this also doesn't work.

Any suggestions?


Regards

David Emerson
Dalyn Software Ltd
25 Cunliffe St, Churton Park
Wellington, New Zealand
Ph/Fax (04) 478-7456
Mobile 027-280-9348 




More information about the AccessD mailing list