By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,489 Members | 1,954 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,489 IT Pros & Developers. It's quick & easy.

Combo Search pulling incorrect field

P: 42
I am trying to create a combo box search on the form with the Part Number but for some reason itís pulling the Part Number Tableís Primary Key. Canít figure out why. Any ideas where to start?

FYI- it's a look up field from a table. I'm trying to research how to fix it because I already invested a lot of time.

Thanks,
JT
Jun 5 '08 #1
Share this Question
Share on Google+
3 Replies


Megalog
Expert 100+
P: 378
Can you post the code you're using for your search? Specifically the part where it calls on the combo box itself. Also, post the sql you're using for the combo's rowsource. You are probably bound to that table's primary key, but on the combo control, you're displaying a different field. So the combo's .Value property is going to be the selected index number of the table.

So the value you visually select (the unbound data), may not be the value that's being passed to your search function.

If this is the case, you can try using the column feature to get the currently selected unbound data.

me.cboObject.Column([Column # starting with 0],[Row #])

In this example, the first number (1) is the second column #, and the Listindex property provides the currently selected row #.

me.cboObject.Column(1, me.cboObject.ListIndex)

There might be a property that just returns what the selected visible text is, but I cant remember what it is offhand.
Jun 5 '08 #2

P: 42
Here's the Code:
Expand|Select|Wrap|Line Numbers
  1. SELECT [Material Inventory].[Material Inventory ID], [Material Inventory].[Part Number] FROM [Material Inventory];
Thanks again!
John
Jun 9 '08 #3

NeoPa
Expert Mod 15k+
P: 31,186
John, you need to look, not at the code so much, as the properties of your ComboBox control. Specifically Column Count, Column Heads and Bound Column. I suspect your Bound Column is set to 2 rather than 1, but read up in the Help system to see what they mean and do.

PS. Please remember to use CODE tags when posting code in future.
Jun 10 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.