Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Nov 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Various formatting for text in a text control (Access 2002)

    Does anyone know how to set a different font format for specific word(s) of text in a text control? For instance:

    txtWarning.value = "Following the rules is VERY IMPORTANT."

    I wanted the words "VERY IMPORTANT" to appear bold and underlined, and I want to do this "dynamic" formatting via VBA. Unfortunately, the search engine in our lounge is currently unavailable, so I have no quick way of finding out whether someone has already posted this challenge. Your input would be greatly appreciated. Thanks! :-)

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Various formatting for text in a text control (Access 2002)

    Unfortunately, there isn't a way to do this with the standard text box. In order to do this sort of thing, you need to use a Rich Text Control. Microsoft has one available as an ActiveX control - you should be able to find it with a search of the Access section of their knowledge base. On the other hand, if this is really static text on a form, you can position multiple labels so that it appears to be a continuous text string and achieve the same effect. Finally, if this is text in a dialog box, there are some tricks that can be played, and there have been posts about that in the not too distant past, but I don't have search ability either. Hopefully one of the other loungers can identify the most recent thread.
    Wendell

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Various formatting for text in a text control (Access 2002)

    Take a look at <post#=35509>post 35509</post#> on formatted msgboxes.
    Charlotte

  4. #4
    New Lounger
    Join Date
    Nov 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Various formatting for text in a text control (Access 2002)

    Yes, I did come across some articles from the Internet about that RTF ActiveX control. From the online help of Access 2002, I also read something about being able to do what I wanted to do, but within a data access page. Unfortunately, I intend to use this formatting approach in a report. It would have been an easy fix if I'm only dealing with static text, but I'm dealing with dynamic text, which is dependent on the contents of the current record I'm printing. The ActiveX control would have been quite a great way to solve my challenge, and it won't be much of a bother to me at all to register this ActiveX control on my machine, except that I won't be the one to use the system I'm building, and I know how "challenging" it is to make an ActiveX control to work properly.

    Thanks for your quick reply! :-)

  5. #5
    New Lounger
    Join Date
    Nov 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Various formatting for text in a text control (Access 2002)

    Thanks, Charlotte, for the link. I'll try this msgbox code in Access 2002. I may have some use of this in the future. :-)

  6. #6
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Various formatting for text in a text control (Access 2002)

    Reports have the same limitations as forms, but you can use an RTF ActiveX control on a report just as you can a form. However, I would suggest you look at using Automation and create the "report" as a Word document. We often take that approach when we want to do complex formatting that goes beyond what Access reports offer. If you aren't familiar with the approach, we have a simple tutorial on our website that includes links to several more detailed Microsoft Knowledge Base and other resources.
    Wendell

Posting Permissions

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