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

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Emulating vbModule behaviour & Microsoft RichText (Ac 2K/Off 2K)

    Author
    Topic
    #385176

    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: “[ Profit ] = [ SKU_Loc_Day_SALES ] / [ SKU_Loc_Day_COST ]”

    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

    Viewing 1 reply thread
    Author
    Replies
    • #663515

      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?

      Brian

    • #663613

      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:

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

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

      Public Function GetColor(lngColor As InterfaceColors) 

      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.

    Viewing 1 reply thread
    Reply To: Emulating vbModule behaviour & Microsoft RichText (Ac 2K/Off 2K)

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

    Your information: