Results 1 to 3 of 3

Thread: exit function

  1. #1
    Join Date
    Oct 2005
    Posts
    23

    Unanswered: exit function

    I have a function checking two controls Saldo and Stock. Sometimes one of the two controls may be empty, having no figures in it.In this case I want to give the command to exit the function.For example, when the control stock is empty, I get the following message :
    You tried to execute a query that does not include the specified expression “stock” as part of an aggregate function
    I do not want to break the function, for the function has other tasks to do,I just want to have no messages for an error but jist skip it. How coul I do it ?
    Part of my function is the following :
    Dim F As Form
    Set F = Forms!FBenchmark
    If Nz(F!Saldo) <> Nz(F!stock) Then

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Do you just need to be shown the IsNull function here?

    If IsNull(F!Saldo ) Then ...

    Hard to say much else since you kinda contradicted yourself:

    I want to give the command to exit the function.
    do not want to break the function, for the function has other tasks to do
    If you could clarify what you want to do and show us the WHOLE function, perhaps we can give you more accurate advice
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    erm.. EXIT FUNCTION?
    Code:
    If Nz(F!Saldo) <> Nz(F!stock) Then Exit function
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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