Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2004
    Posts
    62

    Unanswered: Can i put more than one parameter criteria in one query based search form?

    Hello everyone,
    I have a form with an unbound control linked to a query. So I can put an item name in the control and the query returns all records for that one item. For example, in the query criteria I have
    'Like [forms]![formname]![itemname] & '*').

    Is it possible to use the same underlying query to search my records via the item name or by date. For examples,

    Date Criteria in query:
    IIf(IsNull([forms]![formname]![itemname]), Then Like [forms]![formname]![datename],)
    So if the item name isn't entered but the date is then search by date. If the item name is entered then do not search.

    Item Criteria in query
    IIf(IsNull([forms]![formname]![date]), Then Like [forms]![itemname]![datename],).

    Is this possible? I've tried it but the returned search remains emtpy.
    any advice would be great,
    thanks
    Sue

  2. #2
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634
    Yes.

    Remove the criteria from the query and use either a filter or criteria in VBA depending on what exactly you are trying to do (change the record set on the current form, gather criteria on a form and use it to open another form, gather criteria on a form and use it to open a report).

  3. #3
    Join Date
    Apr 2004
    Posts
    62
    My VBA abilities are next to nothing!! I'm not sure I would know where to start.
    What i would like is to have a form with two unbound controls on it, Date and Item. Below these are the fields from the query, so these return records 'Like' my unbound controls. So my unbound controls act like my search.

    i didn't want to open up another form or report. If I enter a date it will return everything ordered on that date, or if i enter an item it will show me the item and when it was ordered.
    does that make sense?

    i wouldn't know how to make this work in VBA.
    any ideas?

  4. #4
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634
    Open the code (VBA) window for the form (from the forms design view click View - Code). Go to help and look up Apply Filter.

  5. #5
    Join Date
    Apr 2004
    Posts
    62
    I'll give it a shot! Thanks for the help!

Posting Permissions

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