Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    387
    Thanks
    0
    Thanked 1 Time in 1 Post

    compile error (xp)

    I get a compile error when I try to run a function behind a form from the immediate window.
    It's not just the one function, it is any function in any form
    If I move a function to a module then it runs OK.
    Any clues to a cause?
    see the attached jpg
    Attached Images Attached Images

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: compile error (xp)

    The module behind a form is not a standard module, but a class module. Public procedures and functions in a class module aren't "visible" the way they are in a standard module. They act as methods of the class, technically speaking.
    You can call such a procedure or function like this:

    ? Form_frmSomething.ChildCount

    where frmSomething is the name of the form.

  3. #3
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    387
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: compile error (xp)

    Thanks Hans, you are right, I wonder why I'd never noticed this before?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: compile error (xp)

    Perhaps you never tried to call a public procedure / function that is defined in the module behind a form from another module?

  5. #5
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    387
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: compile error (xp)

    Right again - usually don t put functions is form modules and I've always launched subs by causing their events using the form.

    I really appreciate all the help you've given me over the years.

    Best regards

Posting Permissions

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