Thanks in advance for your help. I have 3 controls on a form for the user to enter parameters for the query. Control # 1 is for the WONO, control #2 is for SegNo1 and control #3 is for SegNo2. These fields are in the query, but not in the sql because they aren't needed except to get the correct records. I have code in place to verify these are filled in. these inputs are in the where clause of the sql. Here is the SQL:
strSQL1 = "SELECT Code1 & PN & Code2 & Desc & Code3 & " & _
"TQY & Code4 & Code5 & Code6 & Code7 " & _
"FROM PartsListQ " & _
"WHERE (((PartsListDesc.WONO)=[Forms]![ConversionF]![WONO]) AND ((PartsListDesc.WOSGNO)=[Forms]![ConversionF]![SegNo1] Or (PartsListDesc.WOSGNO)=[Forms]![ConversionF]![SegNo2]))"
When this code runs I get an error code: Too few parameters. Expected 3. When run in the immediate window all 3 parameters are there as entered in the form.
Using just the SegNo1 in the code works perfectly:
strSQL1 = "SELECT Code1 & PN & Code2 & Desc & Code3 & " & _
"TQY & Code4 & Code5 & Code6 & Code7 " & _
"FROM PartsListQ " & _
"WHERE PartsListDesc.WONO = """ & Forms!ConversionF!WONo & _
""" AND PartsListDesc.WOSGNO = """ & Forms!ConversionF!SegNo1 & """"
So the question is how do I enter the SegNo2 into the code so it works? I have tried a lot of different ways and nothing is working so far. I really need to allow the user to enter 2 different segment numbers to get the records needed in 1 query.
Jerry215