Originally posted by Dion Vincent
2. Yes, it is possible. You can apply primary key for multiple fields.
Just to clarify: one primary key (that's why it is primary!) but a PK can
be made up of up to ten fields. The implication is that the _combination_
of all those fields must be unique: e.g. BookName + Author, while each may
not be unique on their own.
3. If your form needs to display some caculated field, you must
use query.
Just to clarify again: you can calculate values on the form or in the
query, and it is usually fairly evenly-balanced to decide which one is more
convenient in any particular situation. For example, use a join query:
SELECT OneTable.Blah, OneTable.Blahblah, OtherTable.etc
FROM OneTable
LEFT JOIN AnotherTable
ON OneTable.FKey = AnotherTable.PKey
ORDER BY OneTable.Blah
or alternatively just set the controlsource of a textbox to:
DLookUp("Etc", "OtherTable", "PKey=" & Me!FKey)
It's generally a good idea to base a form on a query, even if only to limit
the number of records transferred: for example
SELECT * FROM Depots WHERE City="Vegas"
rather than the whole table. Sometimes it's more convenient to build a
complex query and make the form simple; other times it's the other way
round. Ain't it fun being a developer!
Hope that helps
Tim F