How do I reference a form combo box description in reports

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

Guest

I am new to Access coding but quite old in programming, therefore I assume
what is possible but lack the how-to. Can you help out??

I have 2 combo-boxes in an Access 2000 form in which I select the occupation
and family status of a person. These combo-boxes present values from two
linked tables with only two columns each - a code and a description - of
which only the 2nd column is visible and the first is present in both the
master table and the linked tables (naturally).
I would like to reference these descriptions in a report initiated from a
button on the form but cannot seem to be able to. I can reference "standard"
form fields using [Forms]![Entryform]![fieldname], such as the combo-box code
(1st column), but I don't know how to reference the second column which only
exists in the linked table.

Pls help!!!
 
DoctorG said:
I am new to Access coding but quite old in programming, therefore I
assume what is possible but lack the how-to. Can you help out??

I have 2 combo-boxes in an Access 2000 form in which I select the
occupation and family status of a person. These combo-boxes present
values from two linked tables with only two columns each - a code and
a description - of which only the 2nd column is visible and the first
is present in both the master table and the linked tables (naturally).
I would like to reference these descriptions in a report initiated
from a button on the form but cannot seem to be able to. I can
reference "standard" form fields using
[Forms]![Entryform]![fieldname], such as the combo-box code (1st
column), but I don't know how to reference the second column which
only exists in the linked table.

Pls help!!!

The best way to solve the larger problem, IMO, would be to include the
linked tables in the report's recordsource query, appropriately joined
to the master table, and include the descriptions in th query's field
list. That would eliminate any need to refer to the controls on the
form at all.

However, if you really need to refer to the second column of a combo box
on a form, you can use a controlsource expression like this for a text
box on your report:

=[Forms]![Entryform]![controlname].[Column](1)

Note that, for these purposes, the columns are numbered from 0, not 1,
so .Column(1) is the second column.
 
Thanks a lot Dirk!!

Dirk Goldgar said:
DoctorG said:
I am new to Access coding but quite old in programming, therefore I
assume what is possible but lack the how-to. Can you help out??

I have 2 combo-boxes in an Access 2000 form in which I select the
occupation and family status of a person. These combo-boxes present
values from two linked tables with only two columns each - a code and
a description - of which only the 2nd column is visible and the first
is present in both the master table and the linked tables (naturally).
I would like to reference these descriptions in a report initiated
from a button on the form but cannot seem to be able to. I can
reference "standard" form fields using
[Forms]![Entryform]![fieldname], such as the combo-box code (1st
column), but I don't know how to reference the second column which
only exists in the linked table.

Pls help!!!

The best way to solve the larger problem, IMO, would be to include the
linked tables in the report's recordsource query, appropriately joined
to the master table, and include the descriptions in th query's field
list. That would eliminate any need to refer to the controls on the
form at all.

However, if you really need to refer to the second column of a combo box
on a form, you can use a controlsource expression like this for a text
box on your report:

=[Forms]![Entryform]![controlname].[Column](1)

Note that, for these purposes, the columns are numbered from 0, not 1,
so .Column(1) is the second column.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
Back
Top