Preventing Duplicates in Query

J

jakeup

Hey, I'm not even sure if this is possible, but here goes:

I am setting up a Union Query based on two tables. First I am grabbing a combination of two fields, "Connector" and "Pin" from a Circuit table. Each combination has a Symbol ID pointing to a Symbol table which contains the name of that Symbol. On a spreadsheet form, I have a combo box field for Connector/Pin. The combo box displays a listing of the Connector/Pin combinations in the second column, and each respective combination's related Symbol name in the third column. The first column is hidden, and contains an ID based on the Connector/Pin combo and the related Symbol ID. When the user selects the proper combination of the 3, the ID gets stored in the table.

The problem here is that in my combo box, I'm getting "sort of" duplicate records. I say "sort of" because the Connector/Pin combo and the Symbol name combinations are being duplicated, because the hidden IDs are unique. I would like to display the combinations of Connector/Pin and Symbol name only once, regardless of the related ID. However, I still need the ID to be displayed.

I tried using a Select Distinct, but I'm afraid that will only grab one record per ID or Connector/Pin combo or Symbol name, when there could very well be duplicates of the Connector/Pin or Symbol name, which is OK. I just don't want duplications of the combination of the 3. I'm not sure if this even makes sense, much less if it's feasable. Any feedback would be appreciated. Thanks!

Jake
 
L

Lynn Trapp

Jake,
Why do you need to have duplicate Connector/Pin and Symbol combinations in
your table? Allowing duplication like that can be a sign of bad database
design.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


jakeup said:
Hey, I'm not even sure if this is possible, but here goes:

I am setting up a Union Query based on two tables. First I am grabbing a
combination of two fields, "Connector" and "Pin" from a Circuit table. Each
combination has a Symbol ID pointing to a Symbol table which contains the
name of that Symbol. On a spreadsheet form, I have a combo box field for
Connector/Pin. The combo box displays a listing of the Connector/Pin
combinations in the second column, and each respective combination's related
Symbol name in the third column. The first column is hidden, and contains an
ID based on the Connector/Pin combo and the related Symbol ID. When the user
selects the proper combination of the 3, the ID gets stored in the table.
The problem here is that in my combo box, I'm getting "sort of" duplicate
records. I say "sort of" because the Connector/Pin combo and the Symbol name
combinations are being duplicated, because the hidden IDs are unique. I
would like to display the combinations of Connector/Pin and Symbol name only
once, regardless of the related ID. However, I still need the ID to be
displayed.
I tried using a Select Distinct, but I'm afraid that will only grab one
record per ID or Connector/Pin combo or Symbol name, when there could very
well be duplicates of the Connector/Pin or Symbol name, which is OK. I just
don't want duplications of the combination of the 3. I'm not sure if this
even makes sense, much less if it's feasable. Any feedback would be
appreciated. Thanks!
 

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