Results 1 to 7 of 7
  1. #1
    natonstan is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Oct 2014
    Posts
    37

    Simple Query help

    Hello everyone, I need to make a query and i'm new to Access, basically I have a large table with numerous columns, basically I need a query that searches the table for a certain phrase (This phrase is the same always, I don't need any input fields or anything like that) Once it's found that phrase obviously those records would be displayed (most likely on a spreadsheet)

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Could either use the Find tool from ribbon or build query that has the same criteria under every field, but on separate lines so the OR operator is invoked (looks like stair steps).

    Why do you need to search multiple fields for the same criteria? Sounds like data is not normalized.
    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
    natonstan is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Oct 2014
    Posts
    37
    I've actually managed to build a query, now my next issue is I'm trying to display a record using two filters, the first Criteria is that it only shows records with a value in one of the fields, I've got that working fine but then I need it to also look in another field and show records that DON'T contain a phrase, the only problem is that the particular field doesn't just have that value in it, it has other values that aren't relevent to my query, I just need to focus on one particular word in that column, I've tried using the basic 'Not' and 'Not like' phrases but it doesn't seem to pick up on them at all, any ideas? it might help if I showed a screenshot of my table
    Click image for larger version. 

Name:	dsfsdfsdf.png 
Views:	7 
Size:	75.9 KB 
ID:	20885

    The 'IPC' field is what i'm looking at, I need it to show records that don't contain 'BIG', the fact all of the values in there are seperated by ; is the issue in my opinion but I can't be 100%

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    If the IPC field is a simple text type then the content is just a string of characters and LIKE and NOT LIKE with wildcard should work. If this is multi-value field (use of ; separator indicates it is not), that is entirely different issue.

    Post the SQL statement for analysis.
    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
    natonstan is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Oct 2014
    Posts
    37
    Here's the SQL:

    SELECT tblAll.SUPR, tblAll.INV, tblAll.[HIERARCHY DESC], tblAll.IPC
    FROM tblAll
    WHERE (((tblAll.[HIERARCHY DESC])="Sealed Lead Acid Battery") AND (Not (tblAll.IPC)="BIG"));

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Have to use LIKE and wildcard.

    WHERE (((tblAll.[HIERARCHY DESC])="Sealed Lead Acid Battery") AND (Not (tblAll.IPC) LIKE "*BIG*"));
    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.

  7. #7
    natonstan is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Oct 2014
    Posts
    37
    That worked! Thank you so much, that's exactly what I needed, i've learned something today. Thanks again

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

Similar Threads

  1. Help with simple WHERE query
    By accessmatt in forum Queries
    Replies: 1
    Last Post: 07-24-2014, 08:19 PM
  2. Simple Query
    By tombsy in forum Access
    Replies: 2
    Last Post: 02-01-2011, 09:48 AM
  3. Simple query help
    By Subhunter in forum Queries
    Replies: 9
    Last Post: 11-19-2010, 03:32 PM
  4. need help with this simple query
    By dada in forum Programming
    Replies: 3
    Last Post: 08-20-2010, 07:08 AM
  5. Help with a simple query
    By JohnnyO in forum Queries
    Replies: 1
    Last Post: 02-11-2009, 09:43 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