How to efficeintly check if record exists

  • Thread starter Thread starter Anony
  • Start date Start date
A

Anony

Hi All,

I use Access MDB to store lots data records, and lots records need to be
inserted or updated. Before that, I'd check if the record or its ID exists.
The speed is important because data come from network.
For few records, I could use SELECT to verify an record one by one. For this
case without SP, I need a better idea. Does anyone have a good idea?


Thanks for any suggestion,
Anony
 
Ah, no. If you create a unique index on the table, JET will take care of
this for you. If you try to add a duplicate record, the INSERT will fail.
This index can point to one or several fields in the table.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
The most efficient way to check if a record exists before updating
would be to select just its PK or unique index in the WHERE clause of
the UPDATE statement.

--mary
 
Back
Top