Hello,
I am trying to update a lot of tables. Some of them have an autonumber that is not unique or primary key(this is the actual implementation and I whould rather not change it).
When I am trying to update the auto number I receive this error:
"Field cannot be updated."
I know that auto number can not be manually updated in access and I am not trying to do that. I want to update everything else and leave the auto number fields.
The code:
Into the table I have defined field ID:
Data Type: Autonumber
Field Size: Long Integer
New Values: Increment
Indexed: Yes (Duplicates OK)
What I have:
I have tried with all the properties of the field but they seem to be the same as for an integer.
Can you please tell me how to find out whether my field is autonumber or not?
I am trying to update a lot of tables. Some of them have an autonumber that is not unique or primary key(this is the actual implementation and I whould rather not change it).
When I am trying to update the auto number I receive this error:
"Field cannot be updated."
I know that auto number can not be manually updated in access and I am not trying to do that. I want to update everything else and leave the auto number fields.
The code:
Code:
Set RecTableSrc = DBSrc.OpenRecordset(StrTableName, DB_OPEN_DYNASET)
Set RecTableDst = DBDst.OpenRecordset(StrTableName, DB_OPEN_DYNASET)
.....
RecTableSrc.MoveFirst
Do Until RecTableSrc.EOF
RecTableDst.FindFirst strSearch
RecTableDst.Edit
For iFieldCnt = 0 To RecTableSrc.Fields.count - 1
RecTableDst(RecTableSrc(iFieldCnt).Name) = RecTableSrc(iFieldCnt)
Next iFieldCnt
RecTableDst.Update
Loop
Data Type: Autonumber
Field Size: Long Integer
New Values: Increment
Indexed: Yes (Duplicates OK)
What I have:
Code:
CBool(RecTableSrc(iFieldCnt).Attributes = dbAutoIncrField) = False TypeName(RecTableSrc(iFieldCnt).Type) = dbInteger
Can you please tell me how to find out whether my field is autonumber or not?
Comment