davegb wrote:
I've searched here and in the help screens, but I can't find the answer
to a very simple question. How do I create a specific link between 2
records in 2 different tables? I know how to use the Relationship view
to tell Access that a given field is generically linked to another
field in another table. But I can't find a clue as to how to tell it
that Record x in table A is related to Record y in Table B. It seems so
basic, but I can't figure it out. I'm guessing that I just have to type
have one field repeat in both tables and then type the appropriate
value from the other table into that field. Or something like that.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
No, don't do that. The first part of your paragraph seems correct: you
"generically" establish the relationship between the tables, not the
exact values in the columns. E.g.:
VehicleTypes:
vehicle_code integer -- contains the code for different vehicle types
description text -- the acutal names of the vehicle types
MotorPool:
VIN integer - the Vehicle ID Number
vehicle_code integer -- links to VehicleTypes
last_maintenance date -- the last maintenance date of the vehicle
... other columns ...
If you want to write a query that pulls data from both tables, like the
VehicleTypes.description, you'd do this:
SELECT MP.VIN, VT.description, MP.last_maintenance
FROM MotorPool As MP INNER JOIN VehicleTypes As VT
ON MP.vehicle_code = VT.vehicle_code
The results would look something like this:
VIN description last_maintenance
--- ----------- ----------------
2 Sedan 1/3/2005
3 Pickup 2/2/2005
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBQnaOZYechKqOuFEgEQJrxgCffhD2z3oqvff/WHui4uGsXQrh6IEAnjSq
e0QLz2dAh3ikIAttW7Y4dq5b
=SjCa
-----END PGP SIGNATURE-----