+ Reply to Thread
Results 1 to 6 of 6

Variable accross form to module

  1. #1
    Forum Contributor
    Join Date
    02-24-2010
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2003
    Posts
    195

    Thumbs down Variable accross form to module

    I have the below code, which is working perfactly for me.
    However, I want to move the 'Sub Event_Date' from the userform to the actual module.
    what ammendments do I need to consider rather than just doing a cut and paste on the code?
    Cheers guys

    Please Login or Register  to view this content.

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,983

    Re: Variable accross form to module

    That doesn't appear to make any sense since the sub just checks if two textboxes are filled in. Why do you want to move it out of the form's code module?
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Forum Contributor
    Join Date
    02-24-2010
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2003
    Posts
    195

    Re: Variable accross form to module

    I have the Assign Paths to Variable code with in the module, Ive included that below.
    I want to move all subs from the UserForm and leave it as a script of Call commands if at all possible.

    Please Login or Register  to view this content.

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,983

    Re: Variable accross form to module

    All I can see that achieving is creating a need for public variables (which is bad), unless you rewrite all your code. If you want to separate logic from interface (which is a good aim) your button click should call one routine and pass it all the variables required from the form. The called routine should then call the other routines passing local variables as required.

  5. #5
    Forum Contributor
    Join Date
    02-24-2010
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2003
    Posts
    195

    Re: Variable accross form to module

    Cheers for the advice, I think I'll give it a shot!

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,983

    Re: Variable accross form to module

    For the record, I would keep the validation of the textboxes in the form's code:
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1