Results 1 to 2 of 2
  1. #1
    cybermahi is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Posts
    4

    How to build query based on the values chosen by the user in the same form

    Hi,



    I am trying to create a form which will fetch the details from the description and Action & Resolution (boxed in red)from the database of same table.

    User can select any of the 10 fields (minimum one and maximum 10) and when he presses the "Fetch Ticket Details" button the values in the Red box have to retrieved.

    The problem here is: Query should be built on run time based on the values chosen above the red box.
    Click image for larger version. 

Name:	IM issue.jpg 
Views:	13 
Size:	113.1 KB 
ID:	10461
    Eg: If user chooses to enter values of status as 1 and category as 1 then the "where" clause should have only the two conditions with "AND" operator. like wise if user chooses to enter values for 4 fields or 5 etc. The fields the user chose not enter should not be in the where condition of the query.

    Please help me to find the solution to write the query dynamically based on the values chosen.

    I am attaching the screen shot to explain.

    Cheers.

  2. #2
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    In your criteria for each of the fields in question, you should put:

    Like "*" & Forms!YourFormName.YourtextboxName & "*"

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

Similar Threads

  1. Replies: 2
    Last Post: 11-12-2012, 03:52 AM
  2. Replies: 2
    Last Post: 05-17-2012, 03:52 PM
  3. build database based on xml schema
    By traymar in forum Access
    Replies: 2
    Last Post: 05-16-2012, 05:58 AM
  4. display a list of values based on user input
    By karl1971 in forum Access
    Replies: 3
    Last Post: 12-06-2011, 09:19 AM
  5. Query returning fields not chosen
    By cam2era in forum Queries
    Replies: 5
    Last Post: 03-23-2011, 11:43 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