Combobox to exclude value from another combobox

April15Hater

Accountant
Local time
Yesterday, 21:54
Joined
Sep 12, 2008
Messages
349
Hi-

I have one combobox (cboFunctionType1) that runs a query properly and is bounded to tblContractorFunction.ContractorFunctionID.

I have a second combobox (cboFunctionType2) that runs the same query, except that I have included in the WHERE clause:
Code:
WHERE (tblContractorFunction.ContractorFunctionID)<>[Forms]![frmQualityControl]![cboFunctionType1])

Does anybody else see anything that I don't that would cause this not to work. I know the rest of the query is right in the second combobox because when I take the additional clause out it reads the same as the first combobox.

Thanks!

Joe
 
You seem to be missing a left parenthesis at the start of your where statement. I presume that you are requerying Combo2 after any change on Combo1.
 
Sorry, I am guilty of posting an excerpt. Here is the full Query:

Code:
SELECT tblContractorFunction.ContractorFunctionID, tblContractorFunction.FunctionID, tblContractorFunction.FunctionType, tblFunction.JobID

FROM tblFunction INNER JOIN tblContractorFunction ON tblFunction.FunctionID = tblContractorFunction.FunctionID

WHERE ((tblContractorFunction.ContractorFunctionID)<>[Forms]![frmQualityControl]![cboFunctionType1]) AND ((tblContractorFunction.FunctionID)=[Forms]![frmQualityControl]![cboFunctionSel]) AND ((tblContractorFunction.FunctionType)<>"Aerial" And (tblContractorFunction.FunctionType)<>"Underground" And (tblContractorFunction.FunctionType)<>"Unit" And (tblContractorFunction.FunctionType)<>"Setup" And (tblContractorFunction.FunctionType)<>"House Count" And (tblContractorFunction.FunctionType)<>"Commercial Count" And (tblContractorFunction.FunctionType)<>"MDU Units") AND ((tblFunction.JobID)=[Forms]![frmQualityControl]![cboJobSel]))

ORDER BY tblContractorFunction.FunctionType;
 
Without seeing the structure of your data, the SQL looks alright on the face of it. Perhaps you could build up the Where statement step by step until you find the argument at which it stops working.
 
Ensure that the Combo Boxes referenced within the SQL Statement are actually providing the proper Column of Data.

.
 

Users who are viewing this thread

Back
Top Bottom