Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2004
    Posts
    67

    Question Unanswered: public sub not found

    I have a public sub declared in a form's module as follows:
    Public Sub psfrmReservations_NewReserv()

    When I call this proc from another form, it says it can't be found. What's up with that? (and its definitely not a typo)

    Thanks,
    David

    for further reading:
    I usually keep my public subs/functions in standard modules, but in this case, I need to work with a number of other subs that are private to the form, so I thought it would be easier to put the public sub in that form (rather than make all the form's subs public).

  2. #2
    Join Date
    May 2006
    Location
    Australia
    Posts
    11
    Is there any private subs / functions that relate to this public sub? If you only use the private subs / functions for this public then you should move it to a module.

    How are you calling this sub? from a form or within code?

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    how are you calling this function?
    I'd rather be riding on the Tiger 800 or the Norton

  4. #4
    Join Date
    Mar 2004
    Location
    belgium
    Posts
    290
    public sub/function in a form's module is public for that form, not for the whole application, so as mentioned you have to place the function or sub in a module and declare it public there.

  5. #5
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    sorry emiel, but that would not make sense.
    if a 'public' declaration is only available form-wide, where would a 'private' declaration be available?

    'public' is available application-wide

    healdem's question remains.
    and a second question: is the form (holding the module (holding the public sub)) open at the time you call?

    izy
    currently using SS 2008R2

  6. #6
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by izyrider
    sorry emiel, but that would not make sense.
    if a 'public' declaration is only available form-wide, where would a 'private' declaration be available?

    'public' is available application-wide

    healdem's question remains.
    and a second question: is the form (holding the module (holding the public sub)) open at the time you call?

    izy
    Probably not. Access can only find public subs when the called sub in question is available when the form the sub belongs to is open ...
    Back to Access ... ADO is not the way to go for speed ...

Posting Permissions

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