B
Bruce
I have previously described and received a lot of help by
folds here with a training records database. To sum it
up, I have an Employees table and a Training Sessions
table. Each employee may attend many training sessions,
and each training sessions may be attended by many
employees. To address this there is a junction table
between the Employees and Sessions tables, containing
EmployeeID and SessionID (PKs from their respective
tables, FKs in the junction table) and the date.
A form is based on the Sessions table, with a subform
based on the junction table. After entering the Session
information (about 20 possible fields, including
description, instructor, etc.) in the main form, employee
names are selected from a combo box in the subform. The
row source for the combo box is a sql statement that
concatenates Last, First from the Employees table. That
is the visible column; the bound column is EmployeeID.
That works fine for the form, but then I want a report
with the same information, with a line for each attendee
to sign. I can make a report for the session based on the
Sessions table, and a subreport based on the junction
table. The information is there, but I see the
EmployeeID, not the employee name. I know this is not
difficult, but I can't get my brain around it.
The other thing I mentioned is a line for each attendee to
sign, next to his or her name:
Jones, Johnny 1/1/2001 _______________________
etc. I suppose I could do something like format the date
field with a bunch of underscores after the date, but that
bothers me for reasons I can't quite explain.
Finally, I found this code:
Dim ctl As Control
For Each ctl In Controls
ctl.Visible = Not IsNull(ctl)
Next ctl
and placed it in the report detail's Format event so that
empty fields don't take up room. Apparently setting the
Can Shrink property of the text boxes works only when
there are no attached labels. This code seems to take
care of that problem, as long as the labels came with the
text boxes. Independent labels are still a problem, but I
think I can solve it. Is this the best way? It seems
clumsy.
folds here with a training records database. To sum it
up, I have an Employees table and a Training Sessions
table. Each employee may attend many training sessions,
and each training sessions may be attended by many
employees. To address this there is a junction table
between the Employees and Sessions tables, containing
EmployeeID and SessionID (PKs from their respective
tables, FKs in the junction table) and the date.
A form is based on the Sessions table, with a subform
based on the junction table. After entering the Session
information (about 20 possible fields, including
description, instructor, etc.) in the main form, employee
names are selected from a combo box in the subform. The
row source for the combo box is a sql statement that
concatenates Last, First from the Employees table. That
is the visible column; the bound column is EmployeeID.
That works fine for the form, but then I want a report
with the same information, with a line for each attendee
to sign. I can make a report for the session based on the
Sessions table, and a subreport based on the junction
table. The information is there, but I see the
EmployeeID, not the employee name. I know this is not
difficult, but I can't get my brain around it.
The other thing I mentioned is a line for each attendee to
sign, next to his or her name:
Jones, Johnny 1/1/2001 _______________________
etc. I suppose I could do something like format the date
field with a bunch of underscores after the date, but that
bothers me for reasons I can't quite explain.
Finally, I found this code:
Dim ctl As Control
For Each ctl In Controls
ctl.Visible = Not IsNull(ctl)
Next ctl
and placed it in the report detail's Format event so that
empty fields don't take up room. Apparently setting the
Can Shrink property of the text boxes works only when
there are no attached labels. This code seems to take
care of that problem, as long as the labels came with the
text boxes. Independent labels are still a problem, but I
think I can solve it. Is this the best way? It seems
clumsy.