Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2002
    St Albans, Hertfordshire, England
    Thanked 0 Times in 0 Posts

    Emulating vbModule behaviour & Microsoft RichText (Ac 2K/Off 2K)

    Good afternoon folks - two questions today:

    1 - Does anybody have any good working examples of using the Microsoft Rich Text Control? I've looked on the Knowledge Base, but there isn't much available.

    2 - Is it possible to utilise the functionality from vb, where as you type, a list of options are presented for user selection?

    In sum, I want to set up a form, where the user types in the rules of a calculated field - when they type the open square bracket, I want to present them with a list of fields to chose from - when selected, the closing square bracket is assigned, and the field name is presented in bold. As an addition to this, I want the user to be able to select a field (already entered in square brackets), and right click to get a list of alternatives.

    i.e. the finished result would look like this: <font color=yellow>"[ Profit ] = [ SKU_Loc_Day_SALES ] / [ SKU_Loc_Day_COST ]"</font color=yellow>

    A bit of a challenge, I know - but I'm sure that collectively, you'll be able to come up with a suggestion!

    Kind regards

  2. #2
    Star Lounger
    Join Date
    Mar 2001
    Atlanta, Georgia, USA
    Thanked 0 Times in 0 Posts

    Re: Emulating vbModule behaviour & Microsoft RichText (Ac 2K/Off 2K)

    The RichTextBox control can be tricky. I've used it, but I always have to experiment with it.

    What you are looking for is not easily done, at least, for a RichtextBox. If you are using a Listbox or Listform, then you can create a sub-menu and use the control's ShortcutMenuBar property.

    It seems like I have seen a right-click menu for a RichTextBox - somewhere - but I can't find it right now. Do you have to use a RichTextBox control?


  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Sacramento, California, USA
    Thanked 1 Time in 1 Post

    Re: Emulating vbModule behaviour & Microsoft RichText (Ac 2K/Off 2K)

    You're mixing two things up. The RichText control allows for formatting of the text contents, but you aren't going to be able to make it behave like the VB editor, which sounds like what you're trying to do. That would require a great deal more intelligence than is built into the control, and I shudder to think of how much programming you would have to do to implement anything like it. I certainly would never bother, no matter who decided they needed it.

    Access 2000 and 2002 support Enums, if that would help. You create an Enum the same way you create a type, except the elements are constants. For example:

    <pre>Public Enum InterfaceColors
    icMistyRose = &HE1E4FF
    icSlateGray = &H908070
    icDodgerBlue = &HFF901E
    icDeepSkyBlue = &HFFBF00
    icSpringGreen = &H7FFF00
    icForestGreen = &H228B22
    icGoldenrod = &H20A5DA
    icFirebrick = &H2222B2
    End Enum</pre>

    Then if you declare an argument as the enum type, intellisense will drop down the custom elements for that enum.

    <pre>Public Function GetColor(lngColor As InterfaceColors) </pre>

    You still aren't going to be able to make this pop up inside a rich text control when they type in a square bracket though.

Posting Permissions

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