Results 1 to 7 of 7
  1. #1
    RicoU is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2019
    Posts
    9

    Right Function Use in Query

    I am trying to run a query that allows me to identify the cases where a right bracket is the last character in a short text field that holds up to 255 characters.



    When I run the following query no records are returned:

    Right(([varlist_in]![path]),1)

    However, if I change the "1" to say a "10" in the query, I get rows of records to appear.

    So, thinking that maybe the function is somehow accounting for trailing blanks, I changed the query to this.

    Right(Trim([varlist_in]![path]),1)

    Once again, no records are returned.

    I would appreciate any help.

    Thanks.

  2. #2
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    When I run the following query no records are returned:

    Right(([varlist_in]![path]),1)
    I think you are leaving out some important details. That is not a query, that is a calculation. That, in and of itself, would not filter out records.
    Are you doing a calculated field, and then putting something like "]" on the Criteria line of this field?

    Did the data come off of the web or some other program? If so, there may be some special non-visible characters in there that TRIM does not affect (like the famous "non-breaking space")
    If you identify a record that looks like ends in a right bracket, what does this calculated field return for that record?
    Code:
    Asc(Right([varlist_in]![path],1))

  3. #3
    RicoU is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2019
    Posts
    9
    I put this into the criteria line: Right(([varlist_in]![path]),1). I wanted to see if it returned what I expected before updating the query to what I really wanted it to be.

    Next, I was going to change the query to: Right(([varlist_in]![path]),1) = "]" so that I could identify the fields where the value does end with a bracket. I didn't bother trying that part because the first thing I tried didn't even work.

    Thanks for your reply.

  4. #4
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    I put this into the criteria line: Right(([varlist_in]![path]),1)
    Put it under the Criteria line of which field?

    If you just want to see what value it returns, do NOT put it on the Criteria line. Add a calculated field and put in that calculation (so it would appear on the Field line).
    If you put it on the Criteria line of some field, it will only return records where whatever field you are putting it under are equal to the very last character of the "path" field. So any value that is more than one characters long witll be filtered out any you won't see it!

  5. #5
    RicoU is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2019
    Posts
    9
    So what I am trying to do is identify all records where the "path" variable ends with a right bracket.

    So should I put the "Right(([varlist_in]![path]),1) text in the criteria field below the "path" variable name?

  6. #6
    RicoU is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2019
    Posts
    9
    Thanks for your help. You helped me figure out my problem.

    I put this in the criteria field and it worked: Right(Trim([varlist_in]![path]),1)="]"

  7. #7
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    You are welcome.

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

Similar Threads

  1. Replies: 7
    Last Post: 11-22-2017, 01:50 PM
  2. IIf function in a query
    By WAVP375 in forum Access
    Replies: 7
    Last Post: 06-28-2017, 04:57 AM
  3. Query with IIF Function
    By MSdove1 in forum Queries
    Replies: 6
    Last Post: 04-03-2017, 06:07 PM
  4. Sum function within query
    By Vinagray@gmail.com in forum Reports
    Replies: 9
    Last Post: 10-14-2016, 04:23 PM
  5. Replies: 4
    Last Post: 11-19-2010, 07:21 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