J James Napolitano Jun 8, 2004 #1 Is their a way to set the DecimalPlaces property in code when appending a field object? Thanks.
M Marshall Barton Jun 8, 2004 #2 James said: Is their a way to set the DecimalPlaces property in code when appending a field object? Click to expand... Yes, but since that's one of the Access custom properties (as opposed to the Jet builtin properties), you have to create the property yourself. Here's some code that does this for the Caption property: Set dbCur = CurrentDb() Set tdf = dbCur.TableDefs("ZZZ") Set fld = tdf.CreateField("MyField", dbLong) tdf.Fields.Append fld Set prp = fld.CreateProperty("Caption",dbText,"abc") fld.Properties.Append prp fld.Properties.Refresh tdf.Fields.Refresh
James said: Is their a way to set the DecimalPlaces property in code when appending a field object? Click to expand... Yes, but since that's one of the Access custom properties (as opposed to the Jet builtin properties), you have to create the property yourself. Here's some code that does this for the Caption property: Set dbCur = CurrentDb() Set tdf = dbCur.TableDefs("ZZZ") Set fld = tdf.CreateField("MyField", dbLong) tdf.Fields.Append fld Set prp = fld.CreateProperty("Caption",dbText,"abc") fld.Properties.Append prp fld.Properties.Refresh tdf.Fields.Refresh