Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2002
    Location
    Charlotte NC
    Posts
    665

    Unanswered: Filtering Combo Boxes

    I am trying to filter one combo box based on two other combo boxs. Basicaly the user will populate the first two boxes and when the third gets focus it runs this statement:

    Sh_Service_Contract.RowSourceType = "Table/Query"
    Sh_Service_Contract.RowSource = "SELECT dbo_REF_PCRKMS_COMBO_LU_TBL.SC
    FROM dbo_REF_PCRKMS_COMBO_LU_TBL
    where (((dbo_REF_PCRKMS_COMBO_LU_TBL.SC) Is Not Null
    And (dbo_REF_PCRKMS_COMBO_LU_TBL.SC)
    Like IIf([Forms]![Form:_PCRKMS_Selection]![Shipper_Concern] = " * " And [Forms]![Form:_PCRKMS_Selection]![Shipper_Combo] = " * ", " * ",
    IIf([Forms]![Form:_PCRKMS_Selection]![Shipper_Concern] <> " * " And [Forms]![Form:_PCRKMS_Selection]![Shipper_Combo] = " * ", [Forms]![Form:_PCRKMS_Selection]![Shipper_Concern],
    IIf([Forms]![Form:_PCRKMS_Selection]![Shipper_Concern] = " * " And [Forms]![Form:_PCRKMS_Selection]![Shipper_Combo] <> " * ", [Forms]![Form:_PCRKMS_Selection]![Shipper_Combo])))))
    GROUP BY dbo_REF_PCRKMS_COMBO_LU_TBL.SCEnd Sub"

    When it tries to run the SQL code I get the error "Type Missmatch"
    any Ideas?
    Jim
    Last edited by JDionne; 11-05-02 at 14:01.

  2. #2
    Join Date
    Oct 2002
    Posts
    48
    You are using Group By Function, but not using any aggregate function in SELECT clause.

    Either use ORDER BY.

    OR, if you use GROUP BY, use aggregate finction like SUM(), AVG, Count() etc. after SELECT...

  3. #3
    Join Date
    Aug 2002
    Location
    Charlotte NC
    Posts
    665
    I found the answer, I rewrote the query.
    Thanx again
    Jim

    Sh_Service_Contract.RowSourceType = "Table/Query"
    Sh_Service_Contract.RowSource = "SELECT dbo_REF_PCRKMS_COMBO_LU_TBL.SC FROM dbo_REF_PCRKMS_COMBO_LU_TBL WHERE (((dbo_REF_PCRKMS_COMBO_LU_TBL.Sh_Concern) Like [Forms]![Form:_PCRKMS_Selection]![Shipper_Concern]) And ((dbo_REF_PCRKMS_COMBO_LU_TBL.Shipper) Like [Forms]![Form:_PCRKMS_Selection]![Shipper_Combo])) GROUP BY dbo_REF_PCRKMS_COMBO_LU_TBL.SC HAVING (((dbo_REF_PCRKMS_COMBO_LU_TBL.SC) Is Not Null)) ORDER BY dbo_REF_PCRKMS_COMBO_LU_TBL.SC;"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •