Results 1 to 5 of 5
  1. #1
    Join Date
    May 2012
    Posts
    33

    Unanswered: User input from a form to a query

    Hi. I like to make a link from a form where the user can input a search word into a query. See screenshot. Is this possible and how to do it?

    Thanks
    Attached Thumbnails Attached Thumbnails User input query.JPG  

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    either
    write a query and add/pverwrite exisitng queyr in the querydefs collection
    or
    write the query on the fly and execute as required
    or write the parameters and use as appropriate
    or
    write a form which captures the parameter (does soem error checking etc and use that in a predetermined query by referrign to it as
    forms!myformname!myucontrolname.value
    where myformname and mycontrolname are theanmes of that for and the control on that form
    or
    allow user input by inserting reminder text in square brackets. if th SQL parser cannot find the stuff in inside the square brakcets it requests user input with that message

    eg replace "user Input" with "Please specify component:-"

    of the various options the latter is the easiest, requires little or no effort but in my view is a very kludgey way of doing this, especially iof you are going to run the same query several times. there is also no way of error checking input using the later method.

    the second last is marginally better but cannot cater for multiple parameters where one may be not supplied by the user.
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    May 2012
    Location
    Australia
    Posts
    23
    I just did this the other day. In my query criteria i put:

    Like "*" & [Enter Part of the Product Name] & "*"

    When I run the query, I get a parameter box which asks "Enter Part of the Product Name" (See Attached)

    The good thing about using wild cards before and after is that if the search parameter appears anywhere in the bound column it will return results. Although i imagine if you have a lot of items, the query could take a while to run. In my particular db, i have nearly 300 items and the searching is still instant.
    Attached Thumbnails Attached Thumbnails enter parameter.png   query criteria.png  

  4. #4
    Join Date
    May 2012
    Posts
    33
    Thanks, it works

  5. #5
    Join Date
    May 2012
    Location
    Australia
    Posts
    23
    No Problem

Posting Permissions

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