A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Query between 2 tables with one-to-many relationship



 
 
Thread Tools Display Modes
  #1  
Old April 21st, 2010, 08:23 PM posted to microsoft.public.access.queries
gueser
external usenet poster
 
Posts: 7
Default Query between 2 tables with one-to-many relationship

I have a report that I generate via a query which promptme me for a value for
one field of one table. I want to generate all the entries from another
table that correspond to that one field in that main table. I get the info,
but many times over. For exampe if there are 6 entries in the second table,
I get all the info 6 times over. Any ideas on how to correct this?

--
John M Medeiros
Senior Testing Manager
  #2  
Old April 21st, 2010, 08:53 PM posted to microsoft.public.access.queries
XPS350
external usenet poster
 
Posts: 69
Default Query between 2 tables with one-to-many relationship

On 21 apr, 21:23, gueser wrote:
I have a report that I generate via a query which promptme me for a value for
one field of one table. *I want to generate all the entries from another
table that correspond to that one field in that main table. *I get the info,
but many times over. *For exampe if there are 6 entries in the second table,
I get all the info 6 times over. *Any ideas on how to correct this?

--
John M Medeiros
Senior Testing Manager


It seems to me you are not joining the tables. The query should look
like:
SELECT * FROM Table1 INNER JOIN Table2 ON Tabel1.FieldX =
Table2.FieldX;

Groeten,

Peter
http://access.xps350.com
  #3  
Old April 21st, 2010, 10:01 PM posted to microsoft.public.access.queries
Ron2006
external usenet poster
 
Posts: 936
Default Query between 2 tables with one-to-many relationship

It sounds to me as if it is working as expected. Think of it this way.

1) You have an employee master record that has employee name
2) You have a hours table with number of hours per day per employee.

I you create a query that says SHOW the employee name and all the
hours records for an employee. Then if you show the employee name on
the form for each record returned with the query then you will see the
employee name each time/ for each record.

Only 3 solutions I can think of:
1) Use a report to show results and group by employee name (then it
will only show once)
2) Don't show the employee name on the form.
3) Create the form with a subform with the main form showing the
employee name and the subform NOT showing the name.

Ron
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:49 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.