lookup fields

A

Alicia

I have a table that maintains info on equipment. I would
like to associate a computer brand name with various model
numbers. For example, Compaq may have Deskpro 4000 and
Deskpro 2000; DELL may have XPST 450 and GX100.

I would like to be able to select the make and view only
those models associated with the make.

Does anyone know how to do this?
 
T

Tim Ferguson

I would like to be able to select the make and view only
those models associated with the make.

Well, you now have at least three entities: there are computers, there are
models and there are manufacturers.

One way you could model this is to have the three tables like this:

Manufacturers
( Initial Text(5) PRIMARY KEY // e.g. Dell, HP, COMPQ, etc
FullName Text(32) // obvious
Notes Memo // personal notes about
// helpdesk, reliability etc
)


Models
( ModelID Autonumber
Manufacturer Text(5) FOREIGN KEY REFERENCES Manufacturers
FullName Text(32) // eg Desiderata 5000 or whatever
EquipmentList Memo
etc.

(Manufacturer, ModelID) is a PRIMARY KEY
// so that you can refer to it in the Computers table.
)

Computers
( AccessionNum Autonumber PRIMARY KEY
Manufacturer Text(5)
Model Long Integer
LoanedTo
IPAddress
InstallDate
HasOutlook
etc

(Manufacturer, Model) is a FOREIGN KEY REFERENCES Models
)


The slightly odd thing is with the Models table. Using an autonumber is a
simple and easy way to get a new modelid. In theory, we would be quite
happy having the same ModelID number for models from different
manufactures, in practice the bother of roll-your-own identifiers does not
bring any extra benefits. That is why, unusally, the autonumber is not the
PK for the table. Although it happens to be unique across the whole table,
that's not the uniqueness we are interested in.

If you see what I mean!

Hope that helps


Tim F
 
J

Jeff Boyce

Alicia

In addition to Tim's suggestions, I have a question. You've posted in the
tablesdbdesign newsgroup, so does that mean your original post concerns
table design?

If so, you'll probably want to review this newsgroup's history re: Access
"lookup fields" (a pseudo data type available in later versions of Access).
You'll see considerable confusion on the part of folks who have deliberately
or inadvertently used "lookup fields", and considerably more recommendation
AGAINST using them by responders.

Good luck

Jeff Boyce
<Access MVP>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top