Checking for existing entry in table using composite index

D

dhstein

I am reading a text file to add new records to a table. I only want to add
if this is a new record and I will determine that based on comparing the
fields in the text file to the composite index of the table. Can I use the
"seek" method somehow ...


rsWarehouseLocations.Index = "WarehouseSKUAndLocation"
rsWarehouseLocations.Seek "=", {How can I code multiple inputs from text
file here to compare to the composite index?}
If rsWarehouseLocations.NoMatch Then

Msgbox "This is new data to be added to the table"
 
T

Tom van Stiphout

On Fri, 5 Dec 2008 15:58:02 -0800, dhstein

Did you check the help file on the topic of Seek? It clearly says you
need to specify the various values of the composite key:
rs.Seek "=", ValueInFirstFieldOfIndex, ValueInSecondFieldOfIndex, ...

In your case those values should come from your table = linked text
file. You would want to open a readonly recordset on that table. I
have called it rsFrom in previous posts:
rsTo.Seek "=", rsFrom!SomeField, rsFrom!SomeOtherField, ...

-Tom.
Microsoft Access MVP
 
D

dhstein

Tom van Stiphout said:
On Fri, 5 Dec 2008 15:58:02 -0800, dhstein

Did you check the help file on the topic of Seek? It clearly says you
need to specify the various values of the composite key:
rs.Seek "=", ValueInFirstFieldOfIndex, ValueInSecondFieldOfIndex, ...

In your case those values should come from your table = linked text
file. You would want to open a readonly recordset on that table. I
have called it rsFrom in previous posts:
rsTo.Seek "=", rsFrom!SomeField, rsFrom!SomeOtherField, ...

-Tom.
Microsoft Access MVP


Tom,

Thanks so much for your response. The information you provided allowed me
to get the seek on the composite index to work. But actually, I tried to
check the help file on the topic of seek and there was nothing there about
composite indexes - so I must be looking in the wrong place. Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top