Results 1 to 3 of 3
  1. #1
    teachEmToBeGeeks is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2017
    Posts
    4

    Query one search term under multiple fields


    I am creating a DB for a small organization that works with engaged & newly married women. Thus, the members table stores maiden last names and married last names. Is there a way to enter a parameter (lastName="Smith") and get women whose maiden name was Smith OR whose married name is Smith?
    I'm looking for results that might look like this:
    First Maiden Married
    Katie Smith Jones
    Lisa Franklin Smith

    Thanks for your time and assistance!

  2. #2
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    So long as there are separate fields for maiden and married surnames
    Use a text box on a form to enter the name then press a command button to run query based on contents of textbox.


    Sent from my iPhone using Tapatalk

  3. #3
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    let's say your table is:

    Code:
    tblPeople
    P_ID  P_Firstname  P_LastName  P_MaidenName 
    1     Minnie       Mouse       Rat
    2     Daisy        Duck        Mallard
    your query would be

    SELECT * FROM tblPeople WHERE [P_LastName] = 'Duck' or [P_MaidenName] = 'Duck'

    look at the query in a query design window and you'll see what you need to do when you start substituting in field contents from forms.

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

Similar Threads

  1. Replies: 15
    Last Post: 11-26-2015, 11:27 AM
  2. Replies: 5
    Last Post: 03-18-2014, 04:56 PM
  3. Replies: 6
    Last Post: 02-26-2014, 05:06 PM
  4. Replies: 11
    Last Post: 11-09-2012, 08:17 AM
  5. Replies: 4
    Last Post: 09-22-2010, 01:47 AM

Tags for this Thread

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