Results 1 to 7 of 7

Thread: Clicking a commandbutton from a module?

  1. #1

    Thread Starter
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    cmdwash_click has to be public in that form

    then

    call form1.cmdwash_click()

  2. #2
    Hyperactive Member Tequila_worm's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    344
    If you have huge amounts of code under one Command Button, its really hard to follow it out. Its best if you were to split it up and in a situation like that what you could do is use

    Public Function or Sub what ever is more usefull

    Its the best when you split if up, its easier to understand.

  3. #3
    Frenzied Member
    Join Date
    Dec 2000
    Posts
    1,195
    no luck.. i changed it to public so it looks like

    public sub cmdwash_click()

    however it still doesnt work.. some error like method or data member not found

  4. #4
    Hyperactive Member ZeroCool's Avatar
    Join Date
    Feb 2002
    Location
    In front of my computer
    Posts
    423
    Form Code:

    Public Sub Command1_Click()
    MsgBox "clicked"
    End Sub

    Form Code End

    Module Code:

    Public Function ClickButton()
    Call Form1.Command1_Click
    End Function

    Module Code End

    I Hope this Helps!

  5. #5
    Junior Member
    Join Date
    Apr 2001
    Location
    Harlingen Holland
    Posts
    28

    Lightbulb reverse

    it may be an idea to put the huge amound of lines in the module
    and call it from your cmd.

    greetz Pietor
    Frisia Rulez the world

    luctor et ejactulato!

  6. #6
    Hyperactive Member GlenW's Avatar
    Join Date
    Nov 2001
    Location
    Gateshead, England
    Posts
    479
    Include a public Sub on the form, that calls cmd_click().
    Then call that from the module.

  7. #7
    Hyperactive Member
    Join Date
    May 2001
    Posts
    414
    This works

    Public Sub ClickIt()
    Form1.cmdwash.Value = True
    End Sub

    In Form1
    Call ClickIt

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