Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2009

    Unanswered: Custom Search Box Query Help

    I am trying to build a custom search form and having some challenges.

    I created a form that pops up when a user hits the search button. It has a combo box with search by options (Ex. Name, City, State for the Organization table). And a Text box for the search string.

    When the search button is clicked I would like a macro (or vb maybe, but my vb is very weak) to run a query through the organization table matching the string (from the text box) with the field (from the combo box).

    The result should be a subform with all of the matches, and a button by each allowing the user to click on the correct record.

    Any and all help is much appreciated.

  2. #2
    Join Date
    Nov 2009
    A friend of mine helped me with part of it, but I am still stuck

    In the query I set up expressions for each possible match

    =IIf([Forms]![frmOrganization_Search]![SearchType]="Name",[Forms]![frmOrganization_Search]![OrganizationSearch],Like "*")

    =IIf([Forms]![frmOrganization_Search]![SearchType]="City",[Forms]![frmOrganization_Search]![OrganizationSearch],Like "*")

    These seem to be working individually, but when I have them in multiple fields the query comes back empty. (If I remove the Iff statement from all but one and leave Like"*" it works) Any Ideas?

  3. #3
    Join Date
    Mar 2009
    Provided Answers: 15
    Here is an example.

    The function GetFieldType returns a numeric code that indicates the type of the field selected in the combo (Numeric, Text, Date/Time or Other). Other data types are not handled in the example.

    A minimum type checking is performed on the data entered to be sought.
    Attached Files Attached Files
    Have a nice day!

Posting Permissions

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