Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combobx to list different items from what table is populated with 1

Status
Not open for further replies.

jallen919

Technical User
Mar 30, 2001
30
US
I have a combo box that is listing all my Account Executives (being pulled for AcctExec table) but it is populating the entry in a Sales table. In the sales table I only reference the Account Executive by their code number (PK in the AcctExec table and FK in the Sales table). I would like for the combo box to show the full name of the Account Executive but populated the related Sales table with just the Account Executive ID -- is this possible?
 
Hi J Allen,
Why sure!
Your Combobox can have 2 (or more) columns: Base this off of a query. first is PK, Second is the name.
Now make sure the column count of the combo is 2, the bound column is #1, and the column widths are 0;2" (if you don't care to see the PK column at all).

A fun way to do this is in the "after update" event of the combo (in Visual Basic) :

Me![NameOfTheFKFieldontheForm]= Me![NameOfTheComboBoxOnTheForm]

Or you can use the same code in the "on click" event of a command button. :)

Gord
ghubbell@total.net
 
One more question....

I will have a Sales order table with multiple records in it. I need to assign each sales order to an active sales person. I need to figure out how to evenly divide up the number of records in the Sales table among the active people in the Salesperson table.

For example if I have 20 sales records and 5 active sales people, the Sales Order table has a column for SalesPersonID -- I want to programmatically populate the SalesPersonID column... but I need to do it evenly based on the number of active sales people.

Any thoughts on how to approach this problem? I'm still in design phase so I'm open to any type of suggestion
 
I think I would have to see how you have structured your tables but this would possible. First:

What if: There are 21 orders?
What if there are 4 orders for your 5 salesmen?

This can be done but would require some priority to the salesmen in any event: Salesman 1 gets his plate filled first....salesman 5 gets the leftovers? Salesman 1 gets the extra ('cause he's really hungry!)?

I think that's the key. Once that is established you would loop through the orders and divide them based on the priority. Leftovers or lack of do the same loop. Ideas? Gord
ghubbell@total.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top