Inputting data fields linked to another table!

C

Chris

I have created a simple database with 2 tables not linked.
One table is the mai table, with all the things I need to
collect. The other is just a table with all the names of
the staff, with a unique staff identifier. One of the
field in the main table, is for staff name, which I have
created as a combo box, and get data from a table, which
is the other table. What it is dont however is not giving
me the staff name, just the unique identifier. Is their a
way of selecting which field from the other table I want
in the combo box when the data comes from another table??

Rgrds

Chris
 
T

Tim Ferguson

What it is dont however is not giving
me the staff name, just the unique identifier.

In terms of what should be stored in the main table, this is quite right.
This is known as a Foreign Key, and you should be enforcing Refential
Integrity to make sure you can't have a non-existent staff identifier.
Is their a
way of selecting which field from the other table I want
in the combo box when the data comes from another table??
Yes: on the form, you put a combo box and set its properties as follows:

ControlSource = StaffMember (the name of the field in the Main table that
holds the staff identifier)

RowSourceType = Query
RowSource = "SELECT Identifier, FullName FROM StaffMembers
"ORDER BY FullName;"

ColumnCount = 2 (one for the identifier, one for the FullName)
BoundColumn = 1 (the identifier, because that is the one you are storing)
ColumnWidths = "0;" (the first column is zero width, i.e. hidden, and the
second column uses as much space as is left, i.e. all of it)

That is about it, really. I think the combo box wizard does something like
it, but I can never get mine to work and anyway it's easier doing it
yourself.

Hope that helps


Tim F
 

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