Results 1 to 4 of 4
  1. #1
    deepakg27 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2017
    Posts
    160

    Queries Like Operator-Multiple Choices

    Hi Guys,



    I have made a query where based on multiple choices table is being refined on the fly. Everything seems working fine and for most of the part it does.

    Problem being faced is, I have a table tblParties and tblChallan (tblChallan has the PartyID_FK), which is being used to link the two tables. Now when I search for results based on Like "*" & [Forms]![frmFindChallans]![PartyName] following command results are all Ok, but supposedly the partyID is 6 it gives result for 16, 26,36, 46,56, 66 and so on.

    I tried removing the Like operator from the command also but in that case what happens is we must enter party name to get any results as it demands an exact match. What I need to do is, if the field is left blank results for all the parties matching the other criteria should popup, if any one party is selected then results matching only to that party (Exact) should popup.

    PartyID_FK is storing valus in numbers in table tblChallan
    PartyName
    is a field in tblParty with PartyID (as unique key)
    ROW SOURCE on Form frmFindChallans - SELECT [tblParties].[BuyerID_PK], [tblParties].[PartyName] FROM tblParties ORDER BY [PartyName];

    Hope I have been able to explain my problem. Looking forward to your help.
    Regards
    Deepak Gupta

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,892
    This is a dynamic parameterized query? I never use them. I use VBA to build criteria and apply to form or report when opening.

    But try:

    Like Nz([Forms]![frmFindChallans]![PartyName], "*")
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Are you using lookup fields in your table?
    Perhaps you could provide a screenshot of your table designs and some sample data.
    Good luck with your project.

  4. #4
    deepakg27 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2017
    Posts
    160
    Thanks June, the command worked Perfectly.

    Regards
    Deepak Gupta

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

Similar Threads

  1. Replies: 5
    Last Post: 01-23-2019, 02:03 PM
  2. Replies: 1
    Last Post: 04-27-2015, 10:53 AM
  3. Text String from Form Query - Multiple Choices
    By wrandyrice in forum Access
    Replies: 1
    Last Post: 08-12-2012, 10:58 AM
  4. Replies: 4
    Last Post: 04-07-2011, 03:16 PM
  5. Multiple Choices for Parameters with VBA and Queries
    By weasel7711 in forum Programming
    Replies: 3
    Last Post: 02-02-2011, 09:19 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