A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

list box 2 columns



 
 
Thread Tools Display Modes
  #1  
Old May 11th, 2008, 09:27 AM posted to microsoft.public.access.forms
shank
external usenet poster
 
Posts: 113
Default list box 2 columns

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


  #2  
Old May 11th, 2008, 12:14 PM posted to microsoft.public.access.forms
Rick Brandt
external usenet poster
 
Posts: 4,354
Default list box 2 columns

shank wrote:
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.


--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:07 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.