Results 1 to 8 of 8
  1. #1
    fishhead is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2015
    Posts
    167

    filtering problem

    i have a query that has the two fields [ref] and [customer] in it.

    Because of a design problem that is not reversible i have a 5 digit number in the [ref] field for all customers except 1



    for this problem customer i have a 5 digit number for their individual [ref] and another "summary" [ref] number for this customer with the following format "12345-1". All i have done is added the "-1" to a 5 digit [ref].

    so what i'm trying to do here is have the query return all the 5 digit [ref] for all the customers except for the records that have the [customer] "ABC CO" in which case only show the [ref] numbers for this particular company that ARE NOT 5 digits and show all the other 5 digit [ref]'s.

    I was thinking if there was a way to show all records except "ABC CO" unless [ref] for "ABC CO" > 5 digits. That would work except i don't known the proper way to write this expression?

    any suggestions would be greatly appreciated

    thanks,

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Ref is the unique customer ID?

    Maybe concatenate customer name and ref. Replace example data with actual data for this customer.

    WHERE customerName & ref <> "ABC12345"
    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
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Len([ref])>5 would give you the records where the ref field has more than 5 characters.

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  4. #4
    fishhead is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2015
    Posts
    167
    Thanks Vlad,
    that works for the records for the one specific company "ABC CO" but i need the records with the 5 digit [ref] for all the other companies that are not "ABC CO"

    so the query would return something like the following:

    REF CUSTOMER
    12345 APPLE INC
    65454 MICROSOFT
    45645-1 ABC CO
    54878 FACEBOOK
    98787-1 ABC CO

    See what i'm trying to do here?

    thanks

  5. #5
    fishhead is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2015
    Posts
    167
    I figured something out that seems to work find, thanks everyone!

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Glad you got it working but did you see post 2? Want to share your solution?
    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
    fishhead is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2015
    Posts
    167
    Quote Originally Posted by June7 View Post
    Glad you got it working but did you see post 2? Want to share your solution?

    sure,

    since the good & and bad data was in the same table i was building my query on i created two separate queries one to remove the bad data (5 digit ref's for the problem customer) and another leaving the correct 5 digit companies. Then i combined both queries on another query to combine the data from both into one neat query i could work with. Simple solution really i just hadn't thought of if previously.

    thanks again for the suggestions!

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    And the single query with my suggested filter did not work?
    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.

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

Similar Threads

  1. Problem filtering a subform
    By cebrower in forum Programming
    Replies: 5
    Last Post: 10-21-2019, 01:15 PM
  2. New Form problem after not filtering
    By caniread in forum Forms
    Replies: 5
    Last Post: 02-11-2019, 03:49 PM
  3. Query Filtering Problem
    By David Reading in forum Queries
    Replies: 7
    Last Post: 09-19-2017, 11:03 AM
  4. Date Filtering problem
    By TubbyGrey in forum Access
    Replies: 6
    Last Post: 10-22-2010, 10:46 PM
  5. Problem filtering a report
    By mrk68 in forum Reports
    Replies: 1
    Last Post: 05-03-2009, 09:31 AM

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