Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    254
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to invalidate a public function (Access 2000)

    How can I make invalid a public function?

    I have two public function, PrintOriginal and PrintCopies. These two functions take part into a third function, In the following way

    PrintOriginal
    Close
    PrintCopies
    Etc etc

    Is it possible to nullify the action of the function PrintOriginal ? Something like that:
    PrintOriginal
    Close
    PrintOriginal = Nothing
    PrintCopies

    Etc etc

    I have some reasons to do that because some of the codes in the first function do not allow
    The coding in the second function


    I have tried with the following:
    PrintOrigina= Nothing

    However I receive the message Object required


    What command shall I give so that the action of one function is stopped and does not inflience the further coding?

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: How to invalidate a public function (Access 2000)

    You wrote:
    >Is it possible to nullify the action of the function PrintOriginal ? <

    I have no idea what you mean by this. If, in fact, PrintOriginal is a function (and not a sub), you could have it return some value like this:

    If PrintOriginal( ) = something then
    PrintCopies
    end if

    But I don't really know what it is you are trying to do.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: How to invalidate a public function (Access 2000)

    Do you mean that a third routine calls both PrintOriginal and PrintCopies? What do you mean by "nullifying the action" of PrintOriginal. You can't undo an action that a function took. However, if you're talking about the value returned by PrintOriginal (assuming of course that it is a function and not a sub), you do that by first assigning the result of the function to a variable instead of just calling it, and then you reset the variable. So if PrintOriginal returns a boolean value, you would do something like this:

    blnResult = PrintOriginal()
    ...
    blnResult = False

    However, what you laid out in your message isn't clear at all. Is this supposed to be some kind of pseudocode? What are you closing with Close?

    If your routines step all over each other, then your code is badly written. A public function should accept arguments and return a value, period. If your public functions are populating a global variable, you've just discovered why global variables are a bad idea.
    Charlotte

Posting Permissions

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