Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Feb 2001
    Posts
    369
    Thanks
    2
    Thanked 1 Time in 1 Post

    Passing form in Access VBA

    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

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Passing form in Access VBA

    <hr>pass the message box triggering form to the message box<hr>
    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)
    Charlotte

  3. #3
    3 Star Lounger
    Join Date
    Feb 2001
    Posts
    369
    Thanks
    2
    Thanked 1 Time in 1 Post

    Re: Passing form in Access VBA

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

Posting Permissions

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