Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2004
    Posts
    19

    Unanswered: Passing ComboBox Name to a Sub

    Hi, I have a Form with 10 Comboboxes.

    When clicked, I want them to run the same subroutine. However I want to pass the name of the Combo that was clicked on to the subroutine as a String var. Any clues available ?

    Thanks up front .....Nick

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    pass the name as a parameter

    say your common subroutine is called
    handleClickEvent

    in the combobox on click / on change events

    handleClickEvent(<ComboValue>,<ComboName>)

    your handler function is somethng like
    private function handleClickEvent(strValue as string, optional strComboName as string)
    'insert handling code
    end function

    the optional allows you to omit the strComboName if required
    you could extend it by changing the strValue to variant, and eithr expresly tell the handler what datatype to expect

    HTH

  3. #3
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Public Sub yourSub(cboName As String)
    'stuff
    End Sub


    Private Sub cboYourCombo_AfterUpdate()
    yourSub(me.name)
    End Sub



    edit: Dang, I need to be quicker on the draw next time...
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  4. #4
    Join Date
    Oct 2004
    Posts
    19

    Thanks!!!

    Thanks to both of you.... sorted :-)

    Nick

Posting Permissions

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