Results 1 to 5 of 5
  1. #1
    jtm013 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Aug 2014
    Posts
    117

    Criteria with Form Value

    Hello,



    I am sure this is going to end up being a simple solution, but I am just not seeing it.

    I have a query which searches records based on the value a user puts in a form field.
    The field in question is call TorqueID, and it is a text field.
    I use the good ole method [Forms]![frmTquSearch]![torqueID] placed in the criteria location, to search the records.

    The problem I am running into is that say I have a TorqueID of "Value" but there is another couple of TorqueIDs "Value Type A", "Value Type B", etc.
    If the user inputs "Value" into the field on the form then the query only displays the record with the TorqueID of "Value" and not the type A or type B.

    I know if I were to put- Like "*Value*" into the criteria field it would display them all, but how can I do that same effect whilst using a user supplied value from a form field?

    Thanks for any and all assistance!
    Merry Christmas!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    LIKE "*" & [Forms]![frmTquSearch]![torqueID] & "*"

    Users should not interact directly with tables and queries. I never use dynamic parameters in queries. I use VBA to build filter string and apply to form or report.
    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
    jtm013 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Aug 2014
    Posts
    117
    Quote Originally Posted by June7 View Post
    I use VBA to build filter string and apply to form or report.
    Don't suppose you could point me in the right direction on that then? I am still very new to VBA.
    Thanks for the assist with the syntax on the criteria!

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    Review http://www.allenbrowne.com/ser-62code.html

    DoCmd.OpenReport "report name", , , strWHERE
    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.

  5. #5
    jtm013 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Aug 2014
    Posts
    117
    Thanks for the assist.
    Marking as solved.

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

Similar Threads

  1. Replies: 1
    Last Post: 11-13-2014, 11:34 PM
  2. Replies: 1
    Last Post: 03-28-2013, 07:54 AM
  3. Replies: 5
    Last Post: 09-20-2012, 03:27 PM
  4. Replies: 9
    Last Post: 06-12-2012, 10:22 PM
  5. Open (sub)form linking 2 criteria on current form
    By websterh in forum Programming
    Replies: 2
    Last Post: 02-07-2011, 11:56 PM

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