Results 1 to 7 of 7
  1. #1
    ctonline is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2021
    Posts
    10

    Bold and Hightlight text expression in access query


    Does Access allow to Bold and Highlight an expression set up in Access query? I would like to bold the first name and hightlight the last name in yellow on the below expression. Thank you.

    Expr1: [Employee_File]![First_name] & " " & [Employee_File]![Last_name]



  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,540
    Quote Originally Posted by ctonline View Post
    Does Access allow to Bold and Highlight an expression set up in Access query? I would like to bold the first name and hightlight the last name in yellow on the below expression. Thank you.

    Expr1: [Employee_File]![First_name] & " " & [Employee_File]![Last_name]

    I don't believe that's possible.
    You'd be better of looking at presenting the data in form.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    to split the highlighting you would need to use richtext something like

    Expr1: "<div><strong>" & [first_name] & "</strong> <font style=""BACKGROUND-COLOR:#FFFF00"">" & [last_name] & "</font></div>"

    and in the query properties for that column set the text format property to rich text. Note this property can disappear once you have run the query for the first time so do this by creating a new column

    However better to do this in a form, it will be more stable and users should not be looking at queries directly

  4. #4
    ctonline is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2021
    Posts
    10
    Quote Originally Posted by Ajax View Post
    to split the highlighting you would need to use richtext something like

    Expr1: "<div><strong>" & [first_name] & "</strong> <font style=""BACKGROUND-COLOR:#FFFF00"">" & [last_name] & "</font></div>"

    and in the query properties for that column set the text format property to rich text. Note this property can disappear once you have run the query for the first time so do this by creating a new column

    However better to do this in a form, it will be more stable and users should not be looking at queries directly

    Thank you. The HTML tag works great! Creating a query expression is useful for displaying the various fields information that you may want to copy and paste over to your email. I use the query expression for that.

    Would a report or form format still work better for this? Can I create a form or report to display a query expression and to display it in the Richtext format that I want? Do I need to use the HTML tag as well?

    Thanks.

  5. #5
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    you need to use the html tags and it needs to be part of the value (aka Expr1) whether it is a form or a query.

    it is standard practice that users do not have sight of tables and queries other than through forms/reports. If this is your db and there are no other users, I guess no reason why not to use a query, it just tends to set bad habits. With forms you can automate more (e.g. click a button to send an email, friendly validation checks and the like)

  6. #6
    ctonline is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2021
    Posts
    10
    Thanks again. I find the query expression useful for combining the various fields information I need like the name, title, and ID number using the Concatenate feature to combine the various fields together then copying and pasting the information to my email instead of having to type it out. I use the button wizard to create a button on my form to open up the query with the expression.

    Does Access form or report have a feature to combine the fields information into one display text box? Thanks.

  7. #7
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    not so far as I am aware - ctrl-a will select all but probably won't paste as you require

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

Similar Threads

  1. make the text in the field bold
    By botilismus in forum Queries
    Replies: 8
    Last Post: 12-29-2017, 05:50 PM
  2. Set Label Text To Bold In VBA
    By Juan4412 in forum Programming
    Replies: 3
    Last Post: 03-20-2017, 09:49 AM
  3. How to bold text within concatenate ?
    By adnancanada in forum Queries
    Replies: 12
    Last Post: 02-10-2016, 03:04 AM
  4. How to create a message box with bold text
    By uronmapu in forum Access
    Replies: 5
    Last Post: 07-12-2012, 03:09 AM
  5. How do I Bold the first Text in ListBox
    By uronmapu in forum Access
    Replies: 8
    Last Post: 06-17-2012, 09:32 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