Note that there are some explanatory texts on larger screens.

plurals
  1. POMS Access - Data Type Mismatch
    primarykey
    data
    text
    <p>I have the follow VBA code and it returns a '<em>data type mismatch in criteria expression</em>' while executing. I cannot seem to find out why it is giving me this error.</p> <p>Can anybody help me?</p> <p>VBA: </p> <pre><code>Public Function GezaagdeOmzet(ByVal TotaalPrijs As Double, ByVal AantalArtiklesPerOrder As Double, ByVal TotaalArtiklesPerOrder As Double, ByVal AantalArtiklesVerwijderedUitZaaglijst As Double) As Double Dim result As Double On Error GoTo ErrHandler If IsNumeric(TotaalPrijs) = False Then MsgBox ("TotaalPrijs not a number") MsgBox (TotaalPrijs) End If If IsNumeric(AantalArtiklesPerOrder) = False Then MsgBox ("AantalArtiklesPerOrder not a number") MsgBox (AantalArtiklesPerOrder) End If If IsNumeric(TotaalArtiklesPerOrder) = False Then MsgBox ("TotaalArtiklesPerOrder not a number") MsgBox (TotaalArtiklesPerOrder) End If If IsNumeric(AantalArtiklesVerwijderedUitZaaglijst) = False Then MsgBox ("AantalArtiklesVerwijderedUitZaaglijst not a number") MsgBox (AantalArtiklesVerwijderedUitZaaglijst) End If If Not TotaalPrijs = 0 Then If AantalArtiklesPerOrder &gt; 0 Then result = TotaalPrijs / (AantalArtiklesPerOrder * TotaalArtiklesPerOrder) * AantalArtiklesVerwijderedUitZaaglijst On Error GoTo ErrHandler Else MsgBox ("AantalArtiklesPerOrder is null, Cannot do calculation") End If Else MsgBox ("TotaalPrijs is null, cannot do division") 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> <p><em>SQL Query in MS Access</em></p> <pre><code>GezaagdeOmzet: Sum(GezaagdeOmzet([TotaalPrijs],[tbl_ArtikelsPerOrder]![Aantal],[Totaal],[tbl_ArtikelVerwijderdUitZaaglijst]![Aantal])) </code></pre> <p>Is there anyway to catch the error I'm getting with VBA?</p> <p>Cstr or CDec or CDbl is not handling this error.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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