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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Limit choices in combo box 2 based on box 1 choice

Status
Not open for further replies.

morg59jeep

Technical User
Jun 21, 2006
23
I have a Vendor field for each Vendor and a cost code field. What I need to setup is when a vendor is chosen only the appropriate cost codes for that vendor are available to choose from the combo box. How do I do this on my form. We are having problems where the data entry person enters a cost code that has nothing to do with the vendor chosen.
 
Among other places see thread702-1040180

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
the example that traingamer posted looks like it will only work if (in my situation) each costcode could only be assigned to each vendor. Im my situation though we use more than one vendor depending on whats happening at the time for each costcode.

I currently dont have any table linking vendor and costcode so I am wondering what kind of fields do I use to create the table? Once I get the table right i can work on the form to limit the choices.
 
Sorry for the lack of detail but I am just learning this more advanced stuff. Thanks for your patience lets try again.

Ok here is what I have at this point in detail.

I have a 4 Tables

vendInfo
ID (PK)
vendName
vendAddress
vendPhone

costBreakdowns
costCode (PK)
costName

CostCodeFormControl
FormEntryID (PK)
costCode (lookup from costBreakdowns)
vendName (lookup from vendInfo table)

Bills
Bill ID (PK)
billedAmount
vendName (lookup from vendInfo table)
lotNumber
costCode (lookup from costBreakdowns table)
invoiceNumber

I have a form that is for new entries into the bills table. When you select a vendName from the combo-box it needs to limit the combo-box for costCodes to only those cost codes that match entries in the table CostCodesFormControl ... Each costCode has more than one possible vendName and each vendName has multiple possible costcodes as defiend by the CostCodesFormControl table. How do I go about getting my form to limit these selections.
 
Have you viewed the threads provided by myself and traingamer?

Randy
 
Yes.. those in my understanding dont apply to my situation where I have multiple possiblities. In my situation every vendor has multiple cost codes and every cost code has multiple vendors. I cant figure out how to make your example apply. It does not have a table that has records that define each bunch of possibilities.
 
Use a query like :
Code:
SELECT CostCodeFormControl.costcode, CostCodeFormControl.vendname
FROM CostCodeFormControl
where vendname=[Forms]![your form name]![your vendor combo box]
GROUP BY CostCodeFormControl.costcode, CostCodeFormControl.vendname
;

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top