Link to home
Create AccountLog in
Avatar of thorpey83
thorpey83Flag for Australia

asked on

VB6 & ADO error "Row cannot be located for updating"

I have a VB6 app using ADO to create & edit Access DB's.
I am opening the DB with .CursorLocation =adUseClient and the db is a local file.
As I am adding records and updating there are no issues. But when I change the bookmark property to a previously updated record, I get the above error!
I have spent hours combing the net for solutions but without sucess. I did discover that the fields I was editing before updating had default values and if I removed the default constraint, the problem went away!
Can anyone help me?
Avatar of Den_HBR
Den_HBR

see here:
http://support.microsoft.com/kb/300586


RESOLUTION:
To resolve this problem, remove the default value that is specified for the numeric field in the Access database table.

Alternately, you can run an UPDATE statement on a separate ADO Connection object to update the numeric field in the newly-added record directly in the database and then refresh the ADODC.
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of thorpey83

ASKER

Changing from adOpenStatic to adOpenKeyset fixed the problem but I had to remove the adUseClient from the connection .cursorlocation. I just removed the setting of .cursorlocation altogether. I am in the process of converting my code from DAO to ADO so am very green on all this ADO stuff! Can you help me understand why I had to remove the adUseClient setting?
Hi thorpey83, to add or update record, cursor type of recordset must be adOpenKeyset.
adUserClient will set your cursor focus to application level(Client side)
adServer... means your cursor focus to database.

Some time this property through an error as you faced.