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!

Combo If/Then Validation

Status
Not open for further replies.

seb2

Technical User
Feb 6, 2002
27
0
0
US
Not the normal multi-comboBox question....

I have 2 combo boxes. cboCompany and cboLOB (line of business.

cboCompany pulls from tblProduct.Company
Row source SELECT DISTINCT tblProduct.Company FROM tblProduct;

I want cboLOB to look at cboCompany and then do an if/then check to see which company is listed and then list only those lines of business related. I DON'T WANT IT TO PULL FROM tblProducts. This is a new database and the data isn't there to just do a Select. I thought that this could be a Validation, but cannot figure out how to do it.

example: Company1 only had LOB's A,B, & D
Company2 has C,E,F, & G
Company 3 has A,B, & F
Company4 has B & C

Any suggestions? Need more info??? Any assistance is greatly appreciated. :)


 
Set up a query linking customerid and LOB and use that to populate cboLOB. On the after update event up cboCompany you can set that company as the default for cboLOB or you can write SQL in your code to only select from LOB for companyid = cboCompany and use that as the data source for cboLOB.

Hope this helps. Have a great day!
 
I understand what you're saying.... but how do I indicate mulitple values for a combo box in SQL or VB? (I'm not wanting to pull from a table for cboLOB.)

If cboCompany ="Exxon" then
cboLOB = "Gas", "Oil"
elseIf cobCompany ="Avon" then
cboLOB ="MakeUp", "Nail Polish", "Lotions"
elseIf
etc....
EndIf

What's the proper syntax?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top