Results 1 to 3 of 3
  1. #1
    Danelloc is offline Novice
    Windows 10 Office 365
    Join Date
    Apr 2023
    Posts
    16

    Can I create a search criteria with data from a lookup?

    I have a table with separate fields for First and Last names. I have a query which combines these fields as "Last Name, First Name". I have another table which uses this query as a Lookup for the name.



    When I create a query for this second table, it displays the names in a single field with "Last Name, First Name" as it should.

    I tried to use an [Enter Name] search criteria for the query, but when I try to enter a name (example: Public, Joe), I get an error message "Misspelled or too complex, etc"

    Is the problem that I'm basing the name search on a lookup field?

    If so, is there a way around it?

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    Should work so sounds like what you are actually doing is not what you think you are doing. Provide the sql to both your queries

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Works for me?

    SELECT Crew.Surname, Crew.Initials, [surname] & " " & [initials] AS Expr1
    FROM Crew
    WHERE ((([surname] & " " & [initials]) Like "*" & [Enter Name] & "*"));
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

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

Similar Threads

  1. Replies: 1
    Last Post: 06-28-2018, 10:08 AM
  2. Replies: 5
    Last Post: 12-21-2017, 03:55 PM
  3. Replies: 3
    Last Post: 11-27-2016, 06:34 AM
  4. Entering Data into Textbox as Search Criteria
    By Moonman in forum Programming
    Replies: 1
    Last Post: 12-16-2013, 06:11 PM
  5. Create Report from Search Criteria
    By cbrsix in forum Reports
    Replies: 9
    Last Post: 10-03-2012, 04:19 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