Filling in my table

G

Guest

I have several combo boxes in a form for Injury reports. one for example is
to select what department an employee works in. I have the box linked to a
table with autonumber deciding my primary key for each department. When I
select the department I want I would like the form to show the actual
department but my table to only save the primary key. Also when creating a
report I do not know how to take all the primary key entries (all auto
number) and make them display the actual departments for when I print it out.
Any help would be appreciated. Thanks.
 
J

John Vinson

I have several combo boxes in a form for Injury reports. one for example is
to select what department an employee works in. I have the box linked to a
table with autonumber deciding my primary key for each department. When I
select the department I want I would like the form to show the actual
department but my table to only save the primary key.

The Combo Box wizard on the toolbox will do this for you. Basically
you want the Combo Box to be based on a Query with two fields, the
departmentID (as the bound column) and the department name. Set the
combo's FieldWidths property so that the departmentID column is of
zero width (hence invisible). This will display the name but store the
ID.
Also when creating a
report I do not know how to take all the primary key entries (all auto
number) and make them display the actual departments for when I print it out.
Any help would be appreciated. Thanks.

Base the Report, not on your Table, but on a Query joining the table
to all the relevant lookup tables (department, say). Pull the
Department name from the Department table, and the injury data from
your main table.


John W. Vinson[MVP]
 
G

Guest

Good answer, John; however, if Dahlman may not be familiar with how to
reference the values for the combo box with multiple columns. If you have
DepartmentID as the bound column and DepartmentName as the visible column,
then you will have to use me.cboDept.column(1) to get the name. This assumes
the first column is ID and the second is name. If you use me.cboDept you get
DepartmentID since it is the bound column.
 

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