• Inserting Superscripted ® in Report (VBA Code) (2007)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Inserting Superscripted ® in Report (VBA Code) (2007)

    Author
    Topic
    #453594

    I have a requirement to insert a superscripted ® in an Access report (a form letter) in several places. I have a text box in the report and fill the text box with the contents of the letter using VBA code. The problem is that the position of the ® varies in the text. I’ve tried making it a label in a fixed spot but that doesn’t work well.

    How can I best accomplish this using code? Thanks, in advance.

    Viewing 0 reply threads
    Author
    Replies
    • #1123922

      ® has ASCI code 174 , so you can insert it with Chr(174).

      You need some way of indicating where it needs to go for any VBA code to do it for you. Perhaps you could use some other combination of letters that would not occur otherwise (e.g. xrx) then replace any occurrence of xrx with chr(174), using the Replace function.

      • #1123949

        Thanks for the reply.

        Would this method make the ® superscripted?

        • #1123970

          By default, a text box displays plain text, so you can’t make text superscript. You’d need to use a text field and a text box whose Text Format properties have both been set to Rich Text (this is new in Access 2007). I don’t know how to format part of the text using VBA though, I don’t have Access 2007.

        • #1123995

          As Hans says text boxes are plain text, but the ® is naturally raised a little.
          I will look at Rich text in 2007 later and see if there might be a way to do more there.

          • #1124005

            Unfortunately, I’m developing this in Access 2007 but I need to deploy it in Access 2003. Please don’t invest your time — that is, unless you really want to smile.

            I did find a reference to rich text under memo fields in tables. That’s as far as I got.

            I’ve posed the issue to the user who thinks it may be OK not to superscript the ®. She’s supposed to get back to me.

            Thanks.

            • #1124026

              The Rich Text in 2007 is not really Rich Text. Rather it uses HTML, which provides far fewer options.
              As far as I can see Superscript is not one of them.

              But with 2003 you are stuck with plain text.

            • #1130750

              Any thoughts on how to format part of a text in a 2007 report text control? I’m concatenating two recordset fields and the cleanest solution would be to apply simple bold and or italic formating to one of the two fields based on some other recordset values.

              Thanks,
              Marty

            • #1130808

              A dirty fix would be to put the R on the report superscripted, and toggle the text box’s visible property depending on the record. Just my 2c.

            • #1130909

              At this Access Team Blog page they say:

              “Someone asked about setting the formatting for rich text programmatically, and if there was an object model for the text formatting. There isn’t, but the text is simply HTML, so it isn’t hard to do through code. ”

              So you could try wrapping some text in HTML tags for bold or italics, and see how that goes.

    Viewing 0 reply threads
    Reply To: Inserting Superscripted ® in Report (VBA Code) (2007)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: