call functions in another module

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kkshansid
    New Member
    • Oct 2008
    • 232

    #1

    call functions in another module

    Code:
    Sub main()
    Call mod1.fn1
    Call mod1.fn2
    End Sub
    this function which is in mod2 calls only function 1 but not function 2.kindly help
    Thanx in advance
    access 2007
    vba
  • ahd2008
    New Member
    • Nov 2008
    • 68

    #2
    kkshansid,

    I think no one would be able to help you with regard to your question. You need to add more details to help us to analyze and diagnosis your problem. It would be useful if you could add the code for fn1 and fn2.

    All in all, I can suggest the followings as of now:

    1- Check if fn2 is declared as private function. If it is so, changed it to public
    2- Compile and test fn2 code to see if there are errors which could prevent the calling process.
    3- Make sure that fn2 doesn't require parameters. If it does, then you need to provide.
    4- Add “on error” statement to your code to trap the errors, if there are any, so you can know what the exact problem is.

    Regards,

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32669

      #3
      I expect mod1.fn2 has not been declared as a Public procedure. If it isn't as simple as that then I suggest you include details of what happens when you try to run it. Simply saying it doesn't work is not something we'd expect from someone with over 100 posts to their name.
      Last edited by NeoPa; Jun 29 '12, 01:11 AM. Reason: Spelling.

      Comment

      • kkshansid
        New Member
        • Oct 2008
        • 232

        #4
        both function run if i run them individually but in one call from another function only function first runs.i didnt declared it private but by default its public
        Code:
        sub f1
        'some code
        end sub
        sub f2
        'some code
        end sub

        Comment

        • ahd2008
          New Member
          • Nov 2008
          • 68

          #5
          Brother, I have mentioned that u need to include your codes so we can help you. Also, you need to state exactly what the problem is.Also, When you said your fn2 cannot be called, describe what you get in run time!

          Help us so we can help you

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32669

            #6
            Originally posted by NeoPa
            NeoPa:
            If it isn't as simple as that then I suggest you include details of what happens when you try to run it. Simply saying it doesn't work is not something we'd expect from someone with over 100 posts to their name.
            Did you read the main part of what I posted? It seems such a waste of time and energy repeating myself.

            Comment

            Working...