list box 2 columns

S

shank

I have a form with a list box which gets its values from a lookup table.

Upon submit, the form provides input to an append query.

Column1 is bound and works fine.

However, I also need Column2 in the query. How do I reference Column2 in the
query?

[Forms]![frmNewPO]![frmBoxFactory] is the control reference and that gives
me Column1 as expected.

The column I need from the lookup table is [Prefix]

I'm trying [Forms]![frmNewPO]![frmBoxFactory].[Prefix] and it's not working.

So, maybe the question is "How do I bind 2 columns in the list box?"

thanks
 
R

Rick Brandt

shank said:
I have a form with a list box which gets its values from a lookup
table.
Upon submit, the form provides input to an append query.

Column1 is bound and works fine.

However, I also need Column2 in the query. How do I reference Column2
in the query?

[Forms]![frmNewPO]![frmBoxFactory] is the control reference and that
gives me Column1 as expected.

The column I need from the lookup table is [Prefix]

I'm trying [Forms]![frmNewPO]![frmBoxFactory].[Prefix] and it's not
working.
So, maybe the question is "How do I bind 2 columns in the list box?"

thanks

The syntax for referring to a non-bound column is...

[Forms]![frmNewPO]![frmBoxFactory].Column(1)

The left-most column is Column(0) so Column(1) is actually the second one.

Unfortunately that does not work in a query. You might find that wrapping
the reference in the EVal() function works...

=EVal([Forms]![frmNewPO]![frmBoxFactory].Column(1))

....or you can add a hidden TextBox to your form with a ControlSource of...

[Forms]![frmNewPO]![frmBoxFactory].Column(1)

....and point your query at that control instead.
 

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