I am using the following code portion to add a table to a backend database and then create a field named Fee 1 and set the properties, namely The Format property to Currency. I am getting a Data Type Conversion Error on the line in which I try to create the Format property. What am I missing?
Thanks.
Set db = OpenDatabase(DatabasePath)
' Create a new TableDef object.
Set tdfNew = db.CreateTableDef("Table1")
With tdfNew
' Create fields and append them to the new TableDef object. This must be done before appending the
' TableDef object to the TableDefs collection of the database.
'Add Field 1
Set tdfField1 = .CreateField("Fee!", dbCurrency)
.Fields.Append tdfField1
db.TableDefs.Append tdfNew
End With
Set wrkDefault = DBEngine.Workspaces(0)
Set dbsUpdate = wrkDefault.OpenDatabase(DatabasePath, True)
Set tdfUpdate = dbsUpdate.TableDefs("Table1")
With tdfUpdate
tdfField3.Properties.Append tdfField3.CreateProperty("Caption", dbText, "Fee 1")
tdfField3.Properties.Append tdfField3.CreateProperty("Format", dbCurrency, "Currency")
tdfField3.Properties.Append tdfField3.CreateProperty("Description", dbText, _
"Total Fee 1")
End With
Set wrkDefault = Nothing
Thanks.
Set db = OpenDatabase(DatabasePath)
' Create a new TableDef object.
Set tdfNew = db.CreateTableDef("Table1")
With tdfNew
' Create fields and append them to the new TableDef object. This must be done before appending the
' TableDef object to the TableDefs collection of the database.
'Add Field 1
Set tdfField1 = .CreateField("Fee!", dbCurrency)
.Fields.Append tdfField1
db.TableDefs.Append tdfNew
End With
Set wrkDefault = DBEngine.Workspaces(0)
Set dbsUpdate = wrkDefault.OpenDatabase(DatabasePath, True)
Set tdfUpdate = dbsUpdate.TableDefs("Table1")
With tdfUpdate
tdfField3.Properties.Append tdfField3.CreateProperty("Caption", dbText, "Fee 1")
tdfField3.Properties.Append tdfField3.CreateProperty("Format", dbCurrency, "Currency")
tdfField3.Properties.Append tdfField3.CreateProperty("Description", dbText, _
"Total Fee 1")
End With
Set wrkDefault = Nothing