HowTo assign value from unbound column in combobox to label captio

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

combo box with record source of:
SELECT ClassId, ClassName FROM Classes ORDER BY Classes.ClassName;
bound to column: 1
number of columns: 2
column width: 0";2"
ClassId is an autonumber field
ClassName is text field

how do i assign the text that is displayed in this combobox on a form to a
label caption on a report?
 
figured it out using dlookup

intClassID = Forms!Print!cboClass.Value
strClassNameLabel = DLookup("ClassName", "Classes", "ClassId = " & intClassID)
lblReportName.Caption = strClassNameLabel
 
There are a couple of other ways to do that.

Probably the best way is to join the classes table in the
report's record source query, then use the query as the
report's record source.

A third way that is not normally appropriate for reports
(can be very useful in forms) but could be used if the form
is open with its current record the same, single record that
the report is processing. Those conditions are only met by
certain types of reports, but with that restriction a report
text box could use the expression:
=Forms!theform.thecombobox.Column(1)
 
Back
Top