2 fields on an Index statement???

G

Guest

Is it possible to use 2 indices on a single seek? My table has the following
indices: Unit and Name. The table logic is that a single unit may have up
to 11 different names associated with it. Therefore, to get a unique read,
the two keys need to be "joined" in the seek statement. Here's what I have
got so far:

recTemp.Index = "Unit" & "ResidentName"
recTemp.Seek "=", AptUnit, ResName

The problem here is that the index combines the two names and, of course,
cannot find the "UnitResidentName" column. I've tried using a comma, but to
no avail.

Are there any options other than creating a primary key field that combines
these two values?
 
R

Rick B

Rick Brandt (that is not me) just answered this same question in the QUERIES
newsgroup a few hours ago. The subject is "Creating an Index on Two
Fields".

Rick B
 
G

Guest

Mucho gracias, Senor!

Rick B said:
Rick Brandt (that is not me) just answered this same question in the QUERIES
newsgroup a few hours ago. The subject is "Creating an Index on Two
Fields".

Rick B
 
T

Tim Ferguson

recTemp.Index = "Unit" & "ResidentName"
recTemp.Seek "=", AptUnit, ResName

PARAMETERS AptUnit TEXT, ResName TEXT;
SELECT * FROM MyTable
WHERE Unit=[AptUnit] AND ResidentName = [ResName];


Hope that helps?


Tim F
 

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