Join queries

  • Thread starter Thread starter dk
  • Start date Start date
D

dk

Hi.

I have created a 'right join' query, taking info from two
related tables (one main table and another used for a
subform).

The query is executed after entering a 'Last Name':

SELECT tblGrass.Primary, ..., tblsubfrmGrass.TY, ... FROM
tblsubfrmGrass RIGHT JOIN tblGrass ON tblsubfrmGrass.TY =
tblGrass.Primary
WHERE (((tblGrass.Primary)=[Enter Name])) OR
(((tblsubfrmGrass.TY)=[Enter Name]));


This right join only produces results where the 'Name'
exists in tblGrass, when I want the same Name from the
tblsubfrmGrass to be displayed as well. I can't figure
out how to display info from both the form and the subform
regardless if the join fields are equal or not, or if
the 'Name' only appears on one table and not the other
table.

Any tips on how to correct my query?

TIA,
dk
 
I may have misunderstood, but I have the impression that
names are being stored in both tables. Could it be that
the real issue to address is the table design, so that
names are stored in only 1 table? You could then use
Queries as the data sources for your forms.
 
Hi.
Names are being stored on both tables...but one of the
tables is being used separately for a subform, where I
have to enter multiple entries under one type. This is
the only way I could design it- to use a subform,
otherwise, my main table will complain about duplicate
entries.

Hope this helps in the explanation...any other thoughts?

TIA,
dk

-----Original Message-----
I may have misunderstood, but I have the impression that
names are being stored in both tables. Could it be that
the real issue to address is the table design, so that
names are stored in only 1 table? You could then use
Queries as the data sources for your forms.
-----Original Message-----

Hi.

I have created a 'right join' query, taking info from two
related tables (one main table and another used for a
subform).

The query is executed after entering a 'Last Name':

SELECT tblGrass.Primary, ..., tblsubfrmGrass.TY, ... FROM
tblsubfrmGrass RIGHT JOIN tblGrass ON tblsubfrmGrass.TY =
tblGrass.Primary
WHERE (((tblGrass.Primary)=[Enter Name])) OR
(((tblsubfrmGrass.TY)=[Enter Name]));


This right join only produces results where the 'Name'
exists in tblGrass, when I want the same Name from the
tblsubfrmGrass to be displayed as well. I can't figure
out how to display info from both the form and the subform
regardless if the join fields are equal or not, or if
the 'Name' only appears on one table and not the other
table.

Any tips on how to correct my query?

TIA,
dk
.
.
 
Back
Top