Dependent combo boxes

  • Thread starter Thread starter Jayyde
  • Start date Start date
J

Jayyde

Can someone please tell me what I'm doing wrong this time =\. This code is
causing the form to pop up input boxes asking me to enter parameters that
are already in it's strSQL that's getting passed or one of the variables
coming back from it's strSQL. It's asking for input for sDisplayName and
iProductTypeId...

CODE:

intTypeID = cboType.Column(0)

strSQL = "SELECT dbo_tblProductCategoryTree.iProductCategoryTreeId, " _
& "dbo_tblProductCategoryTreeId.sDisplayName " _
& "FROM dbo_tblProductCategoryTree " _
& "WHERE dbo_tblProductTypeId=" _
& intTypeID _
& " ORDER BY dbo_tblProductCategoryTree.sDisplayName"

cboTree.RowSource = strSQL

I'm guessing it's asking for the sDisplayName because of the order by thing,
but still, it should all be coming back fine. The only thing this rowsource
changes from the original is the WHERE clause.
 
Now I'm really confused, because I just used basically the same code to
filter what's displayed in 2 list boxes on a different form (using rowsource
and a strSQL with just an added WHERE clause again) and they work perfectly.
The only difference is it's in form_open instead of an cbo_afterupdate and
it's pulling its ID for the WHERE clause from a global module instead of
with in the same form. Before anyone asks I tried doing the global module
variable for these combo boxes and still no dice...

I actually also tried removing the ORDER BY and it's still asking for both
the sDisplayName and iProductTypeId.
 
Back
Top