Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The above function is a little strange, as haarrrgh says.</p> <p>It should look more like the code below. You do not need to check that each of the arguments (TotaalPrijs, ByVal AantalArtiklesPerOrder etc) is a number, because you pass them As Double. If you pass anything except a number, such as a letter or Null, you will get an error. If this is not what you want, consider passing the arguments As Variant, you can then check that they are numbers. However, as you are using this in a query, I suggest that you do not use message boxes, if the argument is null, make it zero, if that is what it is supposed to be.</p> <p>Note also GezaagdeOmzet = , rather than result =</p> <p>EDIT re Comments</p> <pre><code>Public Function GezaagdeOmzet(ByVal TotaalPrijs As Variant, _ ByVal AantalArtiklesPerOrder As Variant, _ ByVal TotaalArtiklesPerOrder As Variant, _ ByVal AantalArtiklesVerwijderedUitZaaglijst As Variant) As Double On Error GoTo ErrHandler If (Nz(AantalArtiklesPerOrder,0) * Nz(TotaalArtiklesPerOrder,0)) * _ Nz(AantalArtiklesVerwijderedUitZaaglijst,0) = 0 Then GezaagdeOmzet = 0 Else GezaagdeOmzet = Nz(TotaalPrijs,0) / _ (Nz(AantalArtiklesPerOrder,0) * Nz(TotaalArtiklesPerOrder,0)) * _ Nz(AantalArtiklesVerwijderedUitZaaglijst,0) End If Exit Function ErrHandler: ' MsgBox ("TotaalPrijs: " &amp; TotaalPrijs &amp; " TotaalArtiklesPerOrder: " _ &amp; TotaalArtiklesPerOrder &amp; " AantalArtiklesPerOrder: " &amp; AantalArtiklesPerOrder _ &amp; " AantalArtiklesVerwijderedUitZaaglijst: " _ &amp; AantalArtiklesVerwijderedUitZaaglijst) End Function </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload