C
Carol Giannini
I'm trying to do what was described in this previous post and the related
answer:
*****
You may want to consider a query joining the Vehicle table to the
Tenant table TWICE: just add two instances of Vehicle. Use a criterion
(such as Vehicle_1.VIN > Vehicle.VIN) to ensure that the two instances
refer to different vehicles; use an Outer Join for both instances to
still display tenant data whether they have zero, one, or two
vehicles.
You can then use Vehicle.Make as the source for one the "Vehicle 1"
merge fields, and Vehicle_1.Make as the source for "Vehicle 2".
John W. Vinson[MVP]
*****
I need to do something similar. My first table contains clients, each with
a unique client number. The second table contains up to two related records
for each client. The first table is linked to the second on the client
number, one to many; each record in the second table has an ID number,
auto-assigned so that the second record for each client always has a number
greater than the first.
Because I have to use Word merge documents because of other office needs,
I'm essentially trying to create a query that, for a selected client, will
convert the related records from a vertical format to one horizontal record,
if that makes sense.
I've joined the second table to the first table twice, using a left outer
join, with criteria Record_1.ID > Record.ID. This works great *IF* a client
has two entries in the second table. Queries on clients with no entries or
one entry don't work. Can this be done this way? What am I missing? TIA.
answer:
*****
The problem arises when I use query data from the combined tables to merge
into a Word document. A section of this document list the tenant employee's
vehicle information in columns for "Vehicle 1" and "Vehicle 2". Since the
construct of the document uses the vehicle's particulars as inserted data
fields, when the employee has one vehicle, the merge document prints the
information perfectly. If the employee has two vehicles, the document
prints the same vehicle info twice (once in each "Vehicle" column) instead
of the two different vehicles' particulars output in each of the columns.
You may want to consider a query joining the Vehicle table to the
Tenant table TWICE: just add two instances of Vehicle. Use a criterion
(such as Vehicle_1.VIN > Vehicle.VIN) to ensure that the two instances
refer to different vehicles; use an Outer Join for both instances to
still display tenant data whether they have zero, one, or two
vehicles.
You can then use Vehicle.Make as the source for one the "Vehicle 1"
merge fields, and Vehicle_1.Make as the source for "Vehicle 2".
John W. Vinson[MVP]
*****
I need to do something similar. My first table contains clients, each with
a unique client number. The second table contains up to two related records
for each client. The first table is linked to the second on the client
number, one to many; each record in the second table has an ID number,
auto-assigned so that the second record for each client always has a number
greater than the first.
Because I have to use Word merge documents because of other office needs,
I'm essentially trying to create a query that, for a selected client, will
convert the related records from a vertical format to one horizontal record,
if that makes sense.
I've joined the second table to the first table twice, using a left outer
join, with criteria Record_1.ID > Record.ID. This works great *IF* a client
has two entries in the second table. Queries on clients with no entries or
one entry don't work. Can this be done this way? What am I missing? TIA.