Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO Headaches!

Status
Not open for further replies.

lulo

Programmer
Jan 24, 2001
51
0
0
US
Why do I keep getting this error when trying to delete a record.
"Insufficient Key column information for updating or refreshing."

This is my code:

strCriter = "[Ref ID]=" & stgrsID
gRDB_RS.Find strCriter, , , 1

If gRDB_RS.EOF Then
MsgBox "Record was not found."
Else
gRDB_RS.Delete
MsgBox "Record was successfully deleted."
End If

I also tried this one:

gRDB_RS.Filter = "[Ref ID]=" & stgrsID
gRDB_RS.Delete

But I keep getting the same error above.

Does anybody has any suggestions?

Thanks you in advance.

Lulo
 
Try this

strCriter = "[Ref ID]='" & stgrsID & "'"

Let me know if it works or not. If you choose to battle wits with the witless be prepared to lose.
[machinegun][hammer]
 
Thank you for your quick response foada.
What I did instead is change the CursorLocation to =adUseServer

Now delete works fine without improving the results.

instead of deleting the current record found it deletes the record on my related table not the record currently found.

Any clues?
 
Have you got a primary key in the recordset? ADO can't find the record if you haven't. Peter Meachem
peter @ accuflight.com

 
yes Peter I have primary keys on all my related tables.

Do you know what's the best way connecting to a Access database Jet 4.0?
Or if you might suggest any websites?

Thank you
 
But do you have that field name in the recordset?

Don't know the best way, or if there is a best way. Only know my way. Peter Meachem
peter @ accuflight.com

 
Yes I do have field name on recordset.
 
Odd, I always (nearly) do cnn.execute "DELETE FROM table WHERE Field = " & condition , which is probably faster. Peter Meachem
peter @ accuflight.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top