I have a table called "readings" and a field called "XSRate" which has data in it. I'm using DAO 3.6
At the moment this field is set to 4 decimal places but I want to change it to 2 decimal places (it won't effect the data).
I've tried using...
Function ChangeField()
Dim db As Database, tdf As DAO.TableDef, fld As DAO.Field
Dim prp As DAO.Property
On Error Resume Next
Set db = OpenDatabase("M:\SMData\smdata.mdb")
Set tdf = db.TableDefs!readings
Set fld = tdf.Fields!XSRate
Set prp = fld.CreateProperty("DecimalPlaces", dbByte, 2)
fld.Properties.Append prp
db.Close
Set db = Nothing
End Function
but I get the following error.
Runtime error "3367"
Cannot Append. An object with that name already exists in the collection.
Anyone have any ideas about what I'm doing wrong.
At the moment this field is set to 4 decimal places but I want to change it to 2 decimal places (it won't effect the data).
I've tried using...
Function ChangeField()
Dim db As Database, tdf As DAO.TableDef, fld As DAO.Field
Dim prp As DAO.Property
On Error Resume Next
Set db = OpenDatabase("M:\SMData\smdata.mdb")
Set tdf = db.TableDefs!readings
Set fld = tdf.Fields!XSRate
Set prp = fld.CreateProperty("DecimalPlaces", dbByte, 2)
fld.Properties.Append prp
db.Close
Set db = Nothing
End Function
but I get the following error.
Runtime error "3367"
Cannot Append. An object with that name already exists in the collection.
Anyone have any ideas about what I'm doing wrong.