Results 1 to 7 of 7
  1. #1
    EdKerm is offline Novice
    Windows Vista Access 2007
    Join Date
    Dec 2016
    Location
    Australia
    Posts
    7

    Searched/found text - how to highlight with red color in report

    Hello

    I have managed to get going a simple search routine, borrowed/copied from an MS Access forum. It finds the word or text phrase I am searching for, and it then substitutes the phrase "Found it you little ripper ....." (or similar) and it is underlined, as I want. But I also want the "Found it you little ripper ....." phrase to show up in the report as red colored text. So, it works fine but I have never been able to go that extra small step ie red color text in the resulting report.


    Is there something you can suggest (not actual VBA code, I wouldn't know how or where to insert it, in the VBA spot) to go in the query against a/the particular field that would make the "Found it you little ripper ..." phrase appear in red in the report? It must be extremely simple in practice. I know very little about the code etc behind Access routines but I hope that would not be applicable for my little query? I would be greatly pleased if you could give me the query expression that works!!


    The expression in the query as it stands is:

    Expr1: Replace([booktext2],[forms]![Formfindword]![Text0],"<u>FOUND IT YOU LITTLE RIPPER ............</u>")



    - ? I guess the extra bit (whatever it is) goes in there with this bit -- "<u>FOUND IT YOU LITTLE RIPPER ............</u>"


    I'm really hoping you can help me with this ...!!! And, remember I'm an Access "dummy" so I need the actual expression, not just a vague "Oh, you just have to do [vague whatever ....] If it is html code, I'm sorry I know nothing of that either .... Sorry


    Here's hoping, anyway ....

    EdKerm



    25th June 2019
    Attached Thumbnails Attached Thumbnails highlighting would be good.jpg  

  2. #2
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    I don't think you can return formatted text in a query, but you can use conditional formatting in the report if the query returns a normal string to the report field/control.
    In report design view, select that control and on Ribbon > Format > Conditional Formatting. Lots of CF info and examples can be found if you need help constructing an expression for this.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Can do that expression in textbox set for Rich Text format.

    Doing that calc in query and binding textbox to that calculated field just shows all characters as plain text. Access forces the textbox to Plain Text.
    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.

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    You can add some colour to queries though not in the way you require.
    See http://www.mendipdatasystems.co.uk/a...our/4594424152 for info on what is possible.

    As already stated, use conditional formatting for this purpose in your report.
    Whilst you can also add colour and underlining with rich text, that only works with memo / long text fields and you would need to apply the formatting in the table records.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Actually, the RTF expression works in UNBOUND textbox set as Rich Text. I tested.
    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.

  6. #6
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Hi June
    Yes that's also true. Thanks for pointing it out.
    However for bound controls, you do need a memo/long text field.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  7. #7
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    see the example db in post#3 of this thread

    https://www.access-programmers.co.uk...d.php?t=290820

    you can set the formatting as required using the standard rich text formatting tools, then view the code required which you can then incorporate into your replace statement

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

Similar Threads

  1. Replies: 4
    Last Post: 05-03-2017, 10:37 AM
  2. Change Text color and/or background color
    By Thompyt in forum Reports
    Replies: 2
    Last Post: 02-23-2017, 07:08 PM
  3. Do not highlight text on combox rollover
    By gammaman in forum Forms
    Replies: 1
    Last Post: 12-04-2015, 08:08 AM
  4. Highlight text in memo field
    By silverspr in forum Programming
    Replies: 2
    Last Post: 03-27-2011, 04:58 PM
  5. Replies: 2
    Last Post: 12-07-2010, 03:51 PM

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