Results 1 to 15 of 15
  1. #1
    sdc1234 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    89

    Post Search querry

    I have 3 columns; last, first and mi; my code I am using for the search is (Like "*" & [Forms]![SearchF]![Last] & "*"), the only problem is it only searches by last name. I want to do a search like search last, first and MI; thank you for your help


    -novice...

  2. #2
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    Try putting Like "*" & [Forms]![SearchF]![Last] & "*" in last field.
    (Like "*" & [Forms]![SearchF]![first] & "*") in first field.
    (Like "*" & [Forms]![SearchF]![mi] & "*") in mi field.

    In your query.

    Dale

  3. #3
    sdc1234 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    89
    Quote Originally Posted by rzw0wr View Post
    Try putting Like "*" & [Forms]![SearchF]![Last] & "*" in last field.
    (Like "*" & [Forms]![SearchF]![first] & "*") in first field.
    (Like "*" & [Forms]![SearchF]![mi] & "*") in mi field.

    In your query.

    Dale
    thank you that worked, however I am still having problems generating reports for people without middle names... ex: I have a jon doe and a jon a. doe, I put in the jon a doe and I get dates and dates remaining, but when I just put in jon doe I get a blank report... Is there another way I can do my search?

  4. #4
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    Copy and Paste your SQL.

    Dale

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,847
    You could see if there is anything in the MI field.

    If len(Mi) & "" = 0 then >>>>>No middle initial

  6. #6
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    orange got me thinking.
    If I remember correctly that if the field held a null this did not work.
    Something had to be in every field in the record.

    Dale

  7. #7
    sdc1234 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    89
    Quote Originally Posted by rzw0wr View Post
    orange got me thinking.
    If I remember correctly that if the field held a null this did not work.
    Something had to be in every field in the record.

    Dale

    I have on this querry: ID, LastName, First,Name, MI,(under critera of these three I have the code that you provided for searching), StartDate, EncdDate, then I have an expression
    sdays: Sum(IIf([x-test1]![StartDate]=[x-test1A]![StartDate],[x-test1A]![chk],IIf([x-test1]![StartDate]=[x-test2A]![StartDate],[x-test2A]![chk],IIf([x-test1]![StartDate]=[x-test3A]![StartDate],[x-test3A]![chk],0)))) (to calculate the # of days remaining)


    Click image for larger version. 

Name:	querry.jpg 
Views:	1 
Size:	173.3 KB 
ID:	12781
    Attached Thumbnails Attached Thumbnails querry.gif  

  8. #8
    sdc1234 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    89
    Quote Originally Posted by sdc1234 View Post
    I have on this querry: ID, LastName, First,Name, MI,(under critera of these three I have the code that you provided for searching), StartDate, EncdDate, then I have an expression
    sdays: Sum(IIf([x-test1]![StartDate]=[x-test1A]![StartDate],[x-test1A]![chk],IIf([x-test1]![StartDate]=[x-test2A]![StartDate],[x-test2A]![chk],IIf([x-test1]![StartDate]=[x-test3A]![StartDate],[x-test3A]![chk],0)))) (to calculate the # of days remaining)


    Click image for larger version. 

Name:	querry.jpg 
Views:	1 
Size:	173.3 KB 
ID:	12781
    have I provided enough info?

  9. #9
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    Do you have the same problem or another one.

    If you have another problem you will get better coverage if you start another thread.

    Dale

  10. #10
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,847
    The query shown in post #7 has an AND condition on Firstname, Lastname and MI.
    That means they all must meet your criteria. My guess is they can NOT all meet your
    Search condition simultaneously.

  11. #11
    sdc1234 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    89
    Quote Originally Posted by orange View Post
    The query shown in post #7 has an AND condition on Firstname, Lastname and MI.
    That means they all must meet your criteria. My guess is they can NOT all meet your
    Search condition simultaneously.
    I do not understand, I am searching for a john doe and report shows up blank, my search criteria is set to search for a first, last and middle. when I run the report it searches last name: Doe, First Name: Jon, MI:J, the report comes out how I want with the dates of vacation, however if there is another Jon Doe without a middle name it comes up blank, the code If len(Mi) & "" = 0 then >>>>>No middle initial, where would it go under in my querry. I tried to enter it under MI field but came up with errors.

  12. #12
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,847
    Tell us explicitly What you want to happen, under what conditions, and I'm sure someone will have ideas.
    How does the reporting of people with and without middle initials fit in with your search?
    Are you searching for a specific record(s), or are you trying to run a report with conditions?

    Can you give a clear example showing us what you want as the result when you Search for X?

  13. #13
    sdc1234 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    89
    Quote Originally Posted by orange View Post
    Tell us explicitly What you want to happen, under what conditions, and I'm sure someone will have ideas.
    How does the reporting of people with and without middle initials fit in with your search?
    Are you searching for a specific record(s), or are you trying to run a report with conditions?

    Can you give a clear example showing us what you want as the result when you Search for X?
    I have a database of about 1500 employees, I want to run a report on a specific employee and send them a confirmation of their total/allowed vacation day I have jon j doe and jon doe in my database, In a querry I did a search last, first and MI, the report pulls people with middle names and when I just enter a last and first name, the report comes up blank, (see attachment) the blank report is the jon doe but I have dates for him as well. I hope this helps

    -novice
    Attached Thumbnails Attached Thumbnails report_blank.gif  

  14. #14
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,847
    What is the Primary key of your Employee table?

    You need a means to uniquely identify John Doe vs Jon Doe vs Jon J Doe... Gion Dough vs Juan Dowe

    Surely with 1500 employees and these types of calculations, you're not relying on Names and whether or not you get the proper middle initial.

    You might want to consider a different search approach. Search via Lastname against a combo of Distinct Lastnames; cascading combo to Distinct Firstnames within Lastname selected; etc.

    Good luck with your project.

  15. #15
    sdc1234 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    89
    Quote Originally Posted by orange View Post
    What is the Primary key of your Employee table?

    You need a means to uniquely identify John Doe vs Jon Doe vs Jon J Doe... Gion Dough vs Juan Dowe

    Surely with 1500 employees and these types of calculations, you're not relying on Names and whether or not you get the proper middle initial.

    You might want to consider a different search approach. Search via Lastname against a combo of Distinct Lastnames; cascading combo to Distinct Firstnames within Lastname selected; etc.

    Good luck with your project.
    Primary Key is ID.... do you think it would work if I did the search by email address instead of last, first and mi?

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

Similar Threads

  1. Search Querry Full Name
    By sdc1234 in forum Queries
    Replies: 2
    Last Post: 06-12-2013, 10:12 AM
  2. Querry question.
    By ZJGMoparman in forum Queries
    Replies: 2
    Last Post: 02-20-2013, 11:37 AM
  3. Querry help with Dates
    By jimhmason in forum Access
    Replies: 1
    Last Post: 11-09-2011, 04:36 PM
  4. Update Querry
    By wrenchman123 in forum Queries
    Replies: 0
    Last Post: 02-05-2011, 07:21 AM
  5. Querry formating
    By Zoroxeus in forum Queries
    Replies: 0
    Last Post: 03-07-2006, 11:00 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