Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Edinburgh, Midlothian, Scotland
    Posts
    492
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Formatting text (A2k2)

    Does anyone know how to make part of a text box appear in a different colour.

    I can't use conditional formatting as it changes all the box at a time. I need to convert only part of the text, and using a separate box does not look good from a design viewpoint.

    I've tried Format("My Text","vbred") and various similar alternatives without success. The help File, as ever seems to have little to say on the subject.

    Taking this a stage further, can text be made to blink/flash?

    Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Formatting text (A2k2)

    Hi Colin,

    Basically, Access was designed to be a data processor, not a word processor. It doesn't provide the possibility to format part of a text box. You would need to put an ActiveX RichText control on your form or report for that. The Office Developer Edition comes with such a control, as does Visual Studio 6. There are also third-party RichText controls, for instance from FMS. Handling these controls must be done in code, so it's a lot of work.

    You might use the OnTimer event of a form to make text blink. I'm not very fond of blinking myself, but here is an example:

    In the Properties of the form, select the Events tab.
    Scroll down to the Timer Interval. Enter the interval in milliseconds. So if you want text to blink every second, enter 1000.
    Next, create code for the On Timer event. In the following, I use a label and switch the text color between white and black. You can adapt it to your own needs:

    Private Sub Form_Timer()
    If lblMyLabel.ForeColor = vbBlack Then
    lblMyLabel.ForeColor = vbWhite
    Else
    lblMyLabel.ForeColor = vbBlack
    End If
    End Sub

    Regards,
    Hans

  3. #3
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Edinburgh, Midlothian, Scotland
    Posts
    492
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Formatting text (A2k2)

    Hi Hans,

    Thanks for the advice. I'll leave red text alone, and simply use Conditional formatting, which highlights an important message that I want seen.

    I'll try the blinking, although it is annoying, when relevant, it might be important. The message I want to highlight comes up so infrequently, that it will not annoy in regular use.

    Thanks again


    Colin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •