Results 1 to 6 of 6
  1. #1
    Macaw is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Sep 2019
    Posts
    3

    Cool Changing colour of text

    Good morning. I have checked through the forums but could not find the answer. My client has an invoice form with the invoice number (as text) in the following format 1909/05/07/01

    The 01 is the invoice number of the month: 1st, 2nd. 3rd etc. He would like that number (the last two digits) a different colour than the rest. I know in excel you have the range[].character ...... that you can use. I have tried different ways of doing this in VBA. Conditional formatting does not work. Any suggestions?

    Regards,


    Dmitri

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,938
    you need to use richtext.

    How you use it depends on how the invoice number is generated at the moment - is it stored as a complete value in a field, or calculated from the invoice date in the report?

  3. #3
    Macaw is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Sep 2019
    Posts
    3
    Quote Originally Posted by Ajax View Post
    you need to use richtext.

    How you use it depends on how the invoice number is generated at the moment - is it stored as a complete value in a field, or calculated from the invoice date in the report?
    It is richtext and stored as a value that is entered each time

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    So the value is saved into a memo Rich Text field but it is not actually formatted? Options:
    1. save date and sequence number into separate fields and format each bound textbox
    2. parse the parts into separate textboxes and format each textbox
    3. expression in a single unbound textbox reconstructs string with HTML tags
    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.

  5. #5
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,938
    when the number is created you need add the richtext code for font color - something like

    invnum=left(invnum,len(invnum)-2) & "<font color=""#ED1C24"">" & right(invnum,2) & "</font>"

    Using richtext on a key field like an invoice number is not a good idea - can play havoc with sorting/filtering/criteria. So probably safer to store the number has plaintext and use the above in your form/report recordsource

    An alternative on your invoice report is to have two adjacent controls, one formatted black and populated the left chars, the other red and populated with the last two chars.

  6. #6
    Macaw is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Sep 2019
    Posts
    3
    Thanks folks. Much appreciated.

    invnum=left(invnum,len(invnum)-2) & "<font color=""#ED1C24"">" & right(invnum,2) & "</font>" works like a charm.

    Once again, thanks to all who took the time to respond <3

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

Similar Threads

  1. Changing colour on priority.
    By Chris6789 in forum Access
    Replies: 9
    Last Post: 07-14-2019, 10:52 AM
  2. Replies: 3
    Last Post: 08-22-2016, 08:02 AM
  3. Changing text box back colour
    By Duncan in forum Forms
    Replies: 3
    Last Post: 02-23-2013, 05:32 PM
  4. Changing the colour of a cell?
    By WayneSteenkamp in forum Access
    Replies: 3
    Last Post: 03-08-2012, 10:12 AM
  5. Changing Text colour on value amount
    By stu_C in forum Forms
    Replies: 1
    Last Post: 08-08-2011, 06:58 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