Update Autonumber field
Posted on 2006-10-23
I have a asp script which pulls a bunch of fields from a access database, one of the fields ia a autonumber field, its not direclty editible in access.
But from asp, I would like to be able to edit this field, I tried but I get the following error message :
[Microsoft][ODBC Microsoft Access Driver] Cannot update 'orderid'; field not updateable.
The reason why i want to update it is becuase my credit card processor does not accept duplicate orderid fields, for example if the cc did not go through the first time it will record the orderid, then for exmaple if i correct the cc numbers and process it again it will come back with a duplicate order recieved, so i thought i could change the orderid filed by adding a -1 in front of the exisitng orderid number and running a update query as follws :
strsql = "UPDATE [ORDER] "
Strsql = Strsql & "SET [orderid]=" & orderidnew & " "
Strsql = Strsql & "WHERE [orderid] = " & orderid & ""
howver it doesn't seem to want to update the filed since is a autonuber field... any workarounds with this.. i dont want to change the datatype to integer in access, it must remain autonumber, but using some script in asp, i need to be able to change it if needs be.
i am sure there is a way around this. For example
AUTONUMBER is 123,124,125,126
if i want i should be able to change 124 to 124-1 so :
123,124-1,124,126 and the next autonumber remains 127.