Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2004
    Posts
    6

    Exclamation Unanswered: 2 combo boxes (2 search criteria) wont work

    i have a search form (see atachment1) with 2 combo boxes.
    i have a pruduct form that runs on this query:

    SELECT *
    FROM tblSpeler
    WHERE (((tblSpeler.merk)=forms!frmZoeken!zoektekst1) And ((tblSpeler.type) Like forms!frmZoeken!zoektekst2));

    if i start the the product form, it asks me for the make, and then for the player it finds the right player in the form.
    but via my search form it wont work. it only opens the product form and no records are shown.

    so: in the search form, when i select a "make", and then the "type", and then press search. i want it to show the right record in the product form.
    +
    when i select a make (eg "apple"), i want the type combo box to exclude all the types that are not from apple (eg only: ipod mini, ipod 20gb. right now its like in atachment2.

    i know this is a common question, been trying to figure it out with a eg database, but i cant get it done. all help is welcome

    thanks,

    -d
    Attached Thumbnails Attached Thumbnails search form.jpg   combo box type.jpg  

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Hi Deurwaarder
    first off if you wnat SQL to properly handle your staing fields youneed to enclose then with quotation marks ("). For personal preference I tend to use chr$(34) instead of fighting VB in placing quotes
    so

    WHERE (((tblSpeler.merk)=forms!frmZoeken!zoektekst1) And ((tblSpeler.type) Like forms!frmZoeken!zoektekst2));

    should read

    WHERE tblSpeler.merk=forms!frmZoeken!zoektekst1 And tblSpeler.type Like " & chr$(34) & forms!frmZoeken!zoektekst2 & chr$(34) & ";"

    the like character would normall have a wild card eitehr at the front or back of the field in question

    eg
    forms!frmZoeken!zoektekst2 & "*" & chr$(34) & ";"
    which, if det to IPOD would return anything that began IPOD

    However I don't think this will answer your problem
    I'm presuming that you combo boxes will be referring to numeric data
    Its unusual to use a combo box and then search for a "like" match, the whole point of the combo is that it displays a list.

    It woudl be easier if yoiu attached to database not images as these don't show what you are actually doing
    HTH

Posting Permissions

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