Results 1 to 2 of 2
  1. #1
    shabbaranks is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Oct 2011

    Selecting records based on criteria from user input


    I have a select statement which queries a table and prompts the user to input the name they are searching for. Now the user will put in first (space) lastname but I am storing the names from active directory so they are first.last name.

    Is there a way to use the name which has been put in to pull the actual name out? My current code is below - thanks
    SELECT Table.sUser, Table.Activity, Table.Hours, Table.Project, Table.[Task Date], Table.Description
    FROM Table
    WHERE (((Table.sUser) Like [Enter Name ] & ".") AND ((Table.Approved)=False));

  2. #2
    Stingaway is offline Efficiency Junkie
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    The deep south. Keep going until you hit water basically.
    Instead of using a parameter request, if you put a text box in a form you could use the following wild card sequence to pull the data:

    Like "*" & [Forms]![frm_FORMNAME]![txt_MYFIELDFORINPUT] & "*"

    In this example, my form is named "frm_FORMNAME", and the field on the form that is for the input parameter is named "txt_MYFIELDFORINPUT".

    The wild card asterisks will give you anything in the table that has a match between them. For example, if John.Smith is in the table, putting in "Smi" will return John Smith and any other Smith in the database. Also, you could put in "Jo", "hn", "mi", "oh", "J", etc. and his record (as well as other records) would be returned...

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

Similar Threads

  1. display a list of values based on user input
    By karl1971 in forum Access
    Replies: 3
    Last Post: 12-06-2011, 09:19 AM
  2. Selecting records based on particular value
    By usman400 in forum Queries
    Replies: 4
    Last Post: 09-30-2011, 07:58 AM
  3. Criteria issue when using user input and > < ect
    By scotty562 in forum Queries
    Replies: 3
    Last Post: 11-11-2010, 11:08 AM
  4. Replies: 3
    Last Post: 08-25-2010, 09:03 AM
  5. Replies: 6
    Last Post: 07-22-2010, 05:53 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