query issue

S

Selby

I have a query based on three different tables. All three of my tables are
correct. If I have more than one contact set up for a customer number, when
the query runs it will duplicate each item for every contact that is set up.

Table 1 - Bid Customer Info - Contact Info is auto number and primary key;
customer number, contact name and contact phone
Table 2 - Bid Number Info - Bid ID #, Customer Number, contact name
Table 3 - Bid Item Info - Bid Item ID (auto number), Bid ID Number, item, qty

I am new to setting up a database and really don't know what to look for
within the query set-up to fix the problem. Any help would be appreciated.
 
G

Golfinray

That is almost always because you relationships are incorrect. You may even
have to go back and put autonumber promary keys in your tables. Then go to
relationships and connect you tables. Now when you build the query, connect
the tables properly and it should run ok. Make sure you are not trying to
connect two tables on completely different data. Look in help for
relationships.
 
M

Margaret Bartley

Selby said:
I have a query based on three different tables. All three of my tables are
correct. If I have more than one contact set up for a customer number,
when
the query runs it will duplicate each item for every contact that is set
up.

Table 1 - Bid Customer Info - Contact Info is auto number and primary key;
customer number, contact name and contact phone
Table 2 - Bid Number Info - Bid ID #, Customer Number, contact name
Table 3 - Bid Item Info - Bid Item ID (auto number), Bid ID Number, item,
qty

If you have three contacts fro a customer, and you have the relationship set
up to show all records where the customer numbers match, you will get three
records.

If you want to see the contact name and phone number for specific bids or a
bid items, you will have to put the ContactID in Table 2, which I assume is
the Primary Key of Table 1, and link Table 2 to Table 1 using that
relationship.
 
N

NetworkTrade

query results are never wrong. they may be not what you expect or
want...but they are almost never wrong....it is giving you what your query
logic is asking for

if the duplicate records are absolutely duplicate in every field...then you
can eliminate this by modifying it to a Distinct query; in design view, and
with nothing highlighted select 'View' from the menu bar and then
'Properties' you will see the option for 'Unique Values' change this to
yes and see if it works....

another approach is to define the relationship in the query design view. If
one table has all the records - instead of just a line to the other table
(representing the linked field) click on that line and select a join so that
it ends up looking like an arrow from the table with everything to the other
table. Do for both.... this approach maybe will work also depending on your
tables, fields, etc...one can's say for sure generically.....
 
S

Selby

thanks for all of the info - I did have an extra table in the query that I
did not need and when I took it out it cleared up the duplicate items.

I am now trying to run a query that is running correctly with "old data".
When I enter new data, it does not show up in the query and I get a message
at the bottom of my screen that says " this recordset is not updatable". Any
ideas??
 

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