Results 1 to 10 of 10
  1. #1
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Nevada, USA
    Posts
    207
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Inserting Superscripted in Report (VBA Code) (2007)

    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.
    Carol W.

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Inserting Superscripted in Report (VBA Code) (2007)

    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.
    Regards
    John



  3. #3
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Nevada, USA
    Posts
    207
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Inserting Superscripted in Report (VBA Code) (2007)

    Thanks for the reply.

    Would this method make the superscripted?
    Carol W.

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

    Re: Inserting Superscripted in Report (VBA Code) (2007)

    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.

  5. #5
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Inserting Superscripted in Report (VBA Code) (2007)

    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.
    Regards
    John



  6. #6
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Nevada, USA
    Posts
    207
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Inserting Superscripted in Report (VBA Code) (2007)

    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 <img src=/S/smile.gif border=0 alt=smile width=15 height=15>.

    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.
    Carol W.

  7. #7
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Inserting Superscripted in Report (VBA Code) (2007)

    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.
    Regards
    John



  8. #8
    2 Star Lounger
    Join Date
    Jul 2002
    Location
    Sacramento, CA
    Posts
    193
    Thanks
    3
    Thanked 1 Time in 1 Post

    Re: Inserting Superscripted in Report (VBA Code) (2007)

    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

  9. #9
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Inserting Superscripted in Report (VBA Code) (2007)

    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.
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

  10. #10
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Inserting Superscripted in Report (VBA Code) (2007)

    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.
    Regards
    John



Posting Permissions

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