Page 3 of 3 FirstFirst 123
Results 31 to 43 of 43
  1. #31
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    In the latest version in post #29 I used this:

    Not Like "ABC[*]Open Item Inc" & "*"

    And the total amount in Query1 was consistent with eliminating the three records starting with ABC (@ $5.00 each) but including the ones that have Open and Item. So it looks like you might have something else going on.



    An alternative way to deal with it is to create a new query using like that returns the unique ID of the records containing the string you want to eliminate. Then add that to your original query and create a left outer join from the unique IDs of the table to the unique IDs of the new query, add the unique ID from the query to the list of fields and set IS Null in the Criteria row (basically an unmatched query as suggested by Ajax in post #20).

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

  2. #32
    petes1505 is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Nov 2021
    Posts
    34
    Okay. Let me try that and I'll come back here and post the results. Thanks again for the help. Much appreciated.

  3. #33
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725
    It may be a syntax issue

    Do you have criteria similar to:

    WHERE Description NOT Like "ABC[*]Open Item Inc" & "*"

    I realize you're getting different data, but perhaps you could show us your query SQL.
    We're over 30 posts and still guessing.

    Here is another version

    Code:
    ' ----------------------------------------------------------------
    ' Procedure Name: Nov1021
    ' Purpose: To test NOT Like condition with * within the data and
    '   the string to be checked/ignored starts  "ABC*Open Item Inc~"
    ' Procedure Kind: Sub
    ' Procedure Access: Public
    ' Author: Jack
    ' Date: 10-Nov-21
    '  https://www.accessforums.net/showthread.php?t=84768
    ' ----------------------------------------------------------------
    Sub Nov1021()
              Dim i As Integer
              Dim x(3) As String
    10        x(1) = "ABC*Open Item Inc~ and bla bla bla"
    20        x(0) = "ABC OPENItem  Inc. etc, etc etc..."
    30        x(2) = " ABC*Closed Item Inc~ and related articles to expand the test string"
    40          x(3) = "Preamble ABC*Open Item Inc~ and blaa blah blaugh"
    50        For i = LBound(x) To UBound(x)
    60            If Not x(i) Like "ABC[*]Open Item Inc~*" Then
    70                Debug.Print "x(" & i & ")  " & x(i) & " Is NOT like " & "ABC*Open Item Inc~* --- so process this record"
    80            Else
    90                Debug.Print "x(" & i & ")  " & x(i) & " Is  Like " & "ABC*Open Item Inc~  ----so IGNORE THIS RECORD"
    100           End If
    110       Next i
    End Sub
    RESULT:

    x(0) ABC OPENItem Inc. etc, etc etc... Is NOT like ABC*Open Item Inc~* --- so process this record
    x(1) ABC*Open Item Inc~ and bla bla bla Is Like ABC*Open Item Inc~ ----so IGNORE THIS RECORD
    x(2) ABC*Closed Item Inc~ and related articles to expand the test string Is NOT like ABC*Open Item Inc~* --- so process this record
    x(3) Preamble ABC*Open Item Inc~ and blaa blah blaugh Is NOT like ABC*Open Item Inc~* --- so process this record



  4. #34
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,799
    If others are not having the same issue, that indicates there is a difference in the data set being queried and it seems that's going to remain an issue. However, can you try

    (NOT LIKE "ABC[*]OPEN ITEM Inc~")
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #35
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,420
    to list a few

    Post #1 you said Not Like “ABC*Open Item Inc~“
    Post #2
    suggested NOT LIKE "ABC[*]OPEN ITEM Inc~"
    post #4
    your saidif I reverse things and use Like "ABC*Open Item Inc~"
    post #13 question
    Shouldn't that be Not Like "ABC*Open Item Inc~" & "*"
    post #14 you said
    Here is an example of what I want it to ignore: ABC*Open Item Inc~
    post #21
    exampleIf Not x(i) Like "ABC[*]Open Item Inc~" Then

    then it changes
    post #30 you said
    when I use the term Like "ABC*Open Item Inc"

    so what is with the tilde character ~?

    Is it actually part of the criteria string or something else?

    You have still not provided an example (made up or otherwise) of a record which is being returned which shouldn't be, or one that should be but isn't
    You have still not provided the sql to your query which, for all we know includes other criteria which is messing things up

    quite frankly

    the query is ignoring any line that includes any of the words listed in the criteria. For example, if a line includes the word Open, the query ignores that line. That is the best example I can provide.
    is not good enough.

  6. #36
    petes1505 is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Nov 2021
    Posts
    34
    An alternative way to deal with it is to create a new query using like that returns the unique ID of the records containing the string you want to eliminate. Then add that to your original query and create a left outer join from the unique IDs of the table to the unique IDs of the new query, add the unique ID from the query to the list of fields and set IS Null in the Criteria row (basically an unmatched query as suggested by Ajax in post #20).
    I tried doing this but received an error as it creates a circular reference.

  7. #37
    petes1505 is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Nov 2021
    Posts
    34
    Hello Orange. If it helps, here is the SQL. The field that contains the text I was referring to is tbl_Invoice2_L.Description.

    SELECT tbl_Invoice2_L.SupplierId, tbl_Supplier_L.SupplierName, tbl_Invoice2_L.AccountingDate, tbl_Invoice2_L.Amount, tbl_CompanySite_L.SiteId, tbl_Invoice2_L.CompanySiteId, tbl_CompanySite_L.CompanyLevel2, tbl_CompanySite_L.CompanyLevel3, tbl_Invoice2_L.AccountId, tbl_GLList_L.[GL Account Name], tbl_Invoice2_L.POId, tbl_GLList_L.[Spend Type], tbl_GLList_L.Addressable, tbl_Supplier_L.SupplierType, tbl_Invoice2_L.Description
    FROM ((tbl_Invoice2_L LEFT JOIN tbl_Supplier_L ON tbl_Invoice2_L.SupplierId = tbl_Supplier_L.SupplierId) LEFT JOIN tbl_CompanySite_L ON tbl_Invoice2_L.CompanySiteId = tbl_CompanySite_L.SiteId) LEFT JOIN tbl_GLList_L ON tbl_Invoice2_L.AccountId = tbl_GLList_L.AccountID;

  8. #38
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,420
    no idea how you can get a circular reference from a single join. Think you need to pay someone, get them to sign a NDA and pass the problem over to them

  9. #39
    petes1505 is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Nov 2021
    Posts
    34
    Hello. The tilde character is included in the string. It was a typo on my part to not include it in my later examples.

    I just provided the SQL. As for an example, the query is ignoring more than it should, so there is no example to provide.

  10. #40
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,420
    I'm going to drop out, tired of trying to get a straight answer

    For the benefit of those remaining this is the sql laid out
    Code:
    SELECT 
    tbl_Invoice2_L.SupplierId, 
    tbl_Supplier_L.SupplierName, 
    tbl_Invoice2_L.AccountingDate,
    tbl_Invoice2_L.Amount, 
    tbl_CompanySite_L.SiteId, 
    tbl_Invoice2_L.CompanySiteId, 
    tbl_CompanySite_L.CompanyLevel2, 
    tbl_CompanySite_L.CompanyLevel3, 
    tbl_Invoice2_L.AccountId, 
    tbl_GLList_L.[GL Account Name], 
    tbl_Invoice2_L.POId, 
    tbl_GLList_L.[Spend Type], 
    tbl_GLList_L.Addressable, 
    tbl_Supplier_L.SupplierType, 
    tbl_Invoice2_L.Description
    FROM ((tbl_Invoice2_L LEFT JOIN tbl_Supplier_L ON tbl_Invoice2_L.SupplierId = tbl_Supplier_L.SupplierId)
    			LEFT JOIN tbl_CompanySite_L ON tbl_Invoice2_L.CompanySiteId = tbl_CompanySite_L.SiteId) 
    				LEFT JOIN tbl_GLList_L ON tbl_Invoice2_L.AccountId = tbl_GLList_L.AccountID;
    Unfortunately, the bit that matters (the criteria) is not included

  11. #41
    petes1505 is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Nov 2021
    Posts
    34
    Ajax,

    There is no criteria. All this query does is pull data from the ten tables and fields listed in the SQL. What I am try to do is add criteria. In tbl_Invoice_L.Description i want it to ignore any line that begins with OTI*Open Item Inc~. That is all I am trying to do.

  12. #42
    petes1505 is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Nov 2021
    Posts
    34
    Quote Originally Posted by Ajax View Post
    no idea how you can get a circular reference from a single join. Think you need to pay someone, get them to sign a NDA and pass the problem over to them
    An alternative way to deal with it is to create a new query using like that returns the unique ID of the records containing the string you want to eliminate. Then add that to your original query and create a left outer join from the unique IDs of the table to the unique IDs of the new query, add the unique ID from the query to the list of fields and set IS Null in the Criteria row (basically an unmatched query as suggested by Ajax in post #20).
    Ajax,

    You were correct and your alternative method solved the issue. When I created the initial query I did so incorrectly. I was staring at the screen for hours and guess I needed to walk away for a while. Once I recognized the error and updated the query it worked perfectly.

    Thank you and everyone on this thread who tried to help, and sorry for any confusion I may have caused. I've only been working with Access for a short while but I'm pretty determined. Again, the help is very much appreciated.

    Pete

  13. #43
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,420
    You are also new to this forum. For the future, if you are having a problem like this, provide the full sql - it was requested back in post #9. It took 26 posts before you provided it and even then not the whole sql so you wasted a lot of peoples time.

Page 3 of 3 FirstFirst 123
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 13
    Last Post: 06-12-2020, 08:31 AM
  2. Extract specific text from very long string
    By csmith in forum Queries
    Replies: 24
    Last Post: 03-03-2017, 09:25 AM
  3. Replies: 6
    Last Post: 05-29-2015, 10:21 AM
  4. Trying to find a value right of specific string with in text
    By weilerda in forum Import/Export Data
    Replies: 2
    Last Post: 10-18-2012, 12:58 PM
  5. Replies: 13
    Last Post: 07-05-2012, 10:33 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