Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exit from function (Access 2000)

    I have big problems with the Exit from the function in case some conditions are not fulfilled. Sometimes i get the results and sometimes not.
    It is very funny. I think something may be worng with my If clause,since actually my two conditions are indpendent.
    Can somebody help me ?

    Below is the part of my function

    ' conditions on which to stop further actions
    If CLng(DCount("items0", "Products", StrCondition)) < CLng(cartons) * CLng(pack) Then
    MsgBox "Not enought quantity", vbInformation + vbOKOnly
    Exit Function
    ElseIf CLng(DCount("branch0", "Products", StrCondition)) <= 0 Then
    MsgBox " not in the warehouse"


    ' if the above 2 conditions are not available, then update....
    ...........
    Exit Function
    End If

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

    Re: Exit from function (Access 2000)

    If the ..... stand for the update code, it is in the wrong place; it should be after the End If:

    ' conditions on which to stop further actions
    If CLng(DCount("items0", "Products", StrCondition)) < CLng(cartons) * CLng(pack) Then
    MsgBox "Not enought quantity", vbInformation + vbOKOnly
    Exit Function
    End If

    If CLng(DCount("branch0", "Products", StrCondition)) = 0 Then
    MsgBox " not in the warehouse"
    Exit Function
    End If

    ' if the above 2 conditions are not available, then update....
    ...........

Posting Permissions

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