Results 1 to 6 of 6

Thread: How to pass paramters to a Form Module please?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    hongkong
    Posts
    251
    Dear Friends,
    I have a child form call frmDocument

    I instantiate a form from it using

    Dim frmD as frmDocument
    Set frmD = New frmDocument

    frmD.Caption = "Workspace" & counter

    frmD.thisVariable = MyParameter
    frmD.show

    But how come thisVariable is nothing when I debug.print it out in the Form_Load event of frmDocument.

    How can I solve it?

    Thanks

  2. #2
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    There are a few ways: Declare a Global variable in a standard module (.bas). Declare a private variable in the form module where the variable you want to pass resides in. Or you can just pass it as an argument to a procedure or function in the destination form. You could also use a property Let statement.
    Last edited by Lethal; Mar 12th, 2001 at 01:21 AM.

  3. #3
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 2000
    Location
    off others' brains
    Posts
    4,345

    Well ...

    Originally posted by cantene
    Dear Friends,
    I have a child form call frmDocument

    I instantiate a form from it using

    Dim frmD as frmDocument
    Set frmD = New frmDocument

    frmD.Caption = "Workspace" & counter

    frmD.thisVariable = MyParameter
    frmD.show

    But how come thisVariable is nothing when I debug.print it out in the Form_Load event of frmDocument.

    How can I solve it?

    Thanks
    Don't know for sure, but try putting this debug.print in the Form_Activate event and see if it gives you the correct results.

    .
    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    hongkong
    Posts
    251

    Dear Lethal

    Can the Let Property be called by other places outside the form module?

    Thanks

  5. #5
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Sure...Just declare the Let Procedure as Public.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    hongkong
    Posts
    251

    Hey, I know what's happen

    When I set frmD.Caption
    the form form event is immediately triggerred so that the subsequent code face error due to not ready preparation of the database connection string.

    Now I just solve it by setting a public variable in a BAS module to allow the Form Load event to read it
    Very low-level solving dirty skill

Posting Permissions

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



Click Here to Expand Forum to Full Width