• Passing form in Access VBA

    • This topic has 2 replies, 2 voices, and was last updated 24 years ago.
    Author
    Topic
    #356995

    A 2K SR1a
    I have created a form to act as a custom message box (as I needed to customise the text on the buttons), but cannot find a way to pass the message box triggering form to the message box and store it so that it can be passed onto subsequent routines (many forms trigger an event that requires exactly the same message box). I can pass the name of the form that opens the message box in openargs, store it in an invisible control in the messagebox form and pass it to subsequent procs, but in these procs I want to use is as a form, not just the name, and (maybe here’s where I’m being stupid) can’t find anyway to create a valid object reference from the name. I could use a global variable, but my wrist’s still sore from the last slapping for such sloppiness.

    What’s the best way to do this?

    Thanks

    Viewing 0 reply threads
    Author
    Replies
    • #529432

      [indent]


      pass the message box triggering form to the message box


      [/indent]I’m not tracking on this. What do you mean by the message box triggering form? I generally give my forms a custom property named CalledFrom. It’s declared as a public string variable and gets set in a variety of ways. It holds the name of the form that called the current form, and I use it to navigate back to the calling form when the current form closes. Is that sort of what you wanted to do?

      If you want to create an object variable from the name, you do it like this:

      Set objForm = Forms(strVariable)

      • #529456

        I hadn’t thought of using a property of the form to hold the information. The Forms(strVariable) was exactly what I needed. Thanks.

    Viewing 0 reply threads
    Reply To: Passing form in Access VBA

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

    Your information: