binding a combo box to with 2 lookup columns to two source columns

G

Guest

I have an adp form with two fields part number and description. Partnumber
is a compbo box with a pick list populated from a seperate lookup table. I
would like to populate the description field with a description when the part
number is selected, is there an easy way to do this?

Examples of tables below.

MainTable
ParNumber, Part Description, Quantity
1-10254, Bottle of wine, 2
1-10255, Cork, 2
etc..

LookupTable
Partnumber, Part Description
1-10254, Bottle of wine
1-10255, Cork
etc...
 
G

Guest

Make your combo a two column combo = Part number (Column(0)) and Description
(Column(1)). Then in the After Update event of the combo:

Me.txtDescription = Me.MyCombo.Column(1)
 
G

Guest

Klatuu,

Thanks for the last posting it really helped. I have now have another
related problem. I have tried to use the same functionality on another form
but have found some problems.

I have 3 colums on the lookup table and wish to bind the second column to
the field in the underlying table but everytime it seems to ignore which
column I have specified and inputs column(0) the primary key. Please see
table structure below.

Table1 - (main table combo is bound to)
PrimaryKey int
field1 int - (this is the one the actual value will go into)
field2
etc..

Table2 - (lookup table used for picklist)
PrimaryKey int
field2 int - (this is the one I have specified in properties column = 1)
field3 string

As I said evertime I pick the selected item the primarykey int value from
table2 is entered into field1 on table1 and I have set it up to enter field2.
Any idea why this doesn't work? Also evertime I change it to use the int
value rather than string on field3 the property to force selection from the
picklist is set to true, not sure why this happens.
 
G

Guest

I have temporarily got arround the problem by using the primary key and
setting the value for the field I actually want but this is not ideal because
I am having to include a field in the view I don't want.

Is there anything I could try?

There isn't much code behind it because its mainly combo properties, SQL
table and SQL stored procedure. I could send screenshots and script of table
structure/stored procedure if you have an email. What is the best way
forward?

Thanks
 
G

Guest

Sorry, smarty, I can't do that. I'm still suffering copious spam from having
done it once and the network people came to my cube and beat me severly.
 
P

privatenews

Hello,

I was not able to reproduce the issue on my side.

In the property of combox bound to table filed1, I configured:

Control source: field1 (table1)

rowsource: SELECT Table2.k2, Table2.filed2 FROM Table2;

boundcolumn: 2

If it is a simple sample database, you could send it to me at
(e-mail address removed), and I might find some clues. Thanks.

Best Regards,

Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

=====================================================



This posting is provided "AS IS" with no warranties, and confers no rights.
 

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