Results 1 to 7 of 7
  1. #1
    ashu.doc is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2012
    Posts
    124

    Search query

    Hi
    I have a filter form in my application, which have certain filters, I have used different filter criterias and each criterias have search button. What I am trying to do is to use one search button and multiple criterias, but it is not working. This looks something like this -
    Click image for larger version. 

Name:	untitled.JPG 
Views:	3 
Size:	68.2 KB 
ID:	9210

    at the moment my search form looks like this -


    Click image for larger version. 

Name:	untitled1.JPG 
Views:	5 
Size:	32.0 KB 
ID:	9211



    but i want one search button and if I enter one or more than one criterias, the query must search datas according to criterias.

    thanks

  2. #2
    ashu.doc is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2012
    Posts
    124
    Sorry the first image was not proper
    Click image for larger version. 

Name:	untitled2.JPG 
Views:	4 
Size:	63.3 KB 
ID:	9212

  3. #3
    ashu.doc is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2012
    Posts
    124
    I think I should be doing "and" in the criteria instead of writing all the criteria in same level but I dont know how can I do it?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Well, this is one method:

    http://access.mvps.org/access/queries/qry0001.htm

    but with that many options, I tend to use dynamic SQL, as demonstrated in the sample db here:

    http://www.baldyweb.com/BuildSQL.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    ashu.doc is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2012
    Posts
    124
    If I say first method is the one I can deal with because I have not got any clue about VBA and SQL. The method in the first one only solves the partial part of my question, it helps in searching in the control if some criteria is defined or if it is left blank. What I am looking for is, several controls on a page with only one query (like we see in any advance search page).

    If you see the second image in my first message, there is a search button for each control, and each search button is linked to a query which is something like this

    forms![form name![combobox/textbox name].

    I want one search button whose query looks into all the controls in that page and give the list of data by matching the controls in database, so what I tried that I put similiar code for each field like you can see in third image, and linked it to one search button, but obviously it is not working, what I want to modify in the query is, so that it matches these controls together for one set of data, instead not search each different control and give me the list which I dont want, so using 'or ' option is not a good idea.

    thanks

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    You would use the same technique on each field and just have one search button. I don't like it on that many fields because as you'll probably see, Access will re-orient the design grid when you save it, an it gets very confusing.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    ashu.doc is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2012
    Posts
    124
    so what is the solution, do you mean i have to put the same code as i have shown, but it is not working with one button?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Help with search query
    By Sirius in forum Queries
    Replies: 0
    Last Post: 08-08-2011, 03:33 PM
  2. Search query HELP
    By sanos_a in forum Forms
    Replies: 2
    Last Post: 04-07-2011, 06:43 AM
  3. ID search Query
    By clarkej in forum Queries
    Replies: 3
    Last Post: 01-25-2011, 08:03 AM
  4. Search Query
    By convey2web in forum Queries
    Replies: 3
    Last Post: 11-08-2010, 02:27 PM
  5. yes/no search query
    By islandboy in forum Queries
    Replies: 7
    Last Post: 06-30-2009, 09:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums