M
MFB via AccessMonster.com
I'm receiving an "Invalid Operation" error when attempting to set the
DecimalPlaces property during creation of a tabledef. The table is being
created based upon the values stored in another table. I've enclosed the code
segments below. This is an Access 2000 database.
Dim db As DAO.Database, rsClientFactor As DAO.Recordset, tdfExtraInfo As DAO.
TableDef
Set tdfExtraInfo = db.CreateTableDef("tblSSNSourceTEST")
With tdfExtraInfo
.Fields.Append .CreateField("EmpSSN", dbText, 11)
.Fields.Append .CreateField("DataSource", dbText, 10)
Do Until rsClientFactor.EOF
.Fields.Append .CreateField("Factor" & rsClientFactor!Factor,
dbDouble)
If Not IsNull(rsClientFactor!DecimalPlaces) Then
Set prpProp = .Fields("Factor" & rsClientFactor!Factor).
CreateProperty("DecimalPlaces", dbByte, 0)
.Fields("Factor" & rsClientFactor!Factor).Properties.Append
prpProp
End If
rsClientFactor.MoveNext
Loop
I've also tried the following instead of the property setting code above:
.Fields("Factor" & rsClientFactor!Factor).Properties.Append .
CreateProperty("DecimalPlaces", dbByte, rsClientFactor!DecimalPlaces)
Both methods return the error. Any help will be appreciated.
-MFB
DecimalPlaces property during creation of a tabledef. The table is being
created based upon the values stored in another table. I've enclosed the code
segments below. This is an Access 2000 database.
Dim db As DAO.Database, rsClientFactor As DAO.Recordset, tdfExtraInfo As DAO.
TableDef
Set tdfExtraInfo = db.CreateTableDef("tblSSNSourceTEST")
With tdfExtraInfo
.Fields.Append .CreateField("EmpSSN", dbText, 11)
.Fields.Append .CreateField("DataSource", dbText, 10)
Do Until rsClientFactor.EOF
.Fields.Append .CreateField("Factor" & rsClientFactor!Factor,
dbDouble)
If Not IsNull(rsClientFactor!DecimalPlaces) Then
Set prpProp = .Fields("Factor" & rsClientFactor!Factor).
CreateProperty("DecimalPlaces", dbByte, 0)
.Fields("Factor" & rsClientFactor!Factor).Properties.Append
prpProp
End If
rsClientFactor.MoveNext
Loop
I've also tried the following instead of the property setting code above:
.Fields("Factor" & rsClientFactor!Factor).Properties.Append .
CreateProperty("DecimalPlaces", dbByte, rsClientFactor!DecimalPlaces)
Both methods return the error. Any help will be appreciated.
-MFB