R
rwboyden via AccessMonster.com
I need to create a field using VBA which will display with 2 decimal places.
I can do it manually using the type "Currency" and the format property
"Fixed". I can create the field with the currency type using the VBA
CreateField function below. I can't seem to figure out the code needed to
set the format property to "Fixed". I understand that the property needs to
be created, but I'm missing something in the syntax. Any suggestions would be
appreciated.
' dbT and tdf have been declared
Dim fld As Field
Dim prop As Property
Set dbT = DBEngine.Workspaces(0).OpenDatabase(strDataPath)
Set tdf = dbT.TableDefs("3 Photo Log")
' Create a New Field
Set fld = tdf.CreateField("Issue Order", dbCurrency)
' Add the Format Property
Set prop = fld.CreateProperty("Format", dbCurrency, "Fixed")
fld.Properties.Append prop
' Append the field to the table
tdf.Fields.Append fld
I can do it manually using the type "Currency" and the format property
"Fixed". I can create the field with the currency type using the VBA
CreateField function below. I can't seem to figure out the code needed to
set the format property to "Fixed". I understand that the property needs to
be created, but I'm missing something in the syntax. Any suggestions would be
appreciated.
' dbT and tdf have been declared
Dim fld As Field
Dim prop As Property
Set dbT = DBEngine.Workspaces(0).OpenDatabase(strDataPath)
Set tdf = dbT.TableDefs("3 Photo Log")
' Create a New Field
Set fld = tdf.CreateField("Issue Order", dbCurrency)
' Add the Format Property
Set prop = fld.CreateProperty("Format", dbCurrency, "Fixed")
fld.Properties.Append prop
' Append the field to the table
tdf.Fields.Append fld