Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The mismatch occurs because the second parameter needs to be a string, not a RecordSet.<br> If any of the parameters in the third argument is a variable (like in your case), the third argument needs to be a concatenated string as well:</p> <pre><code>temp = DLookup("SKUS_ORDERED", "ORDER_DATA", _ "SKUS_ORDERED = '" &amp; curSKU2 &amp; "' and ORDER = " &amp; curOrder) </code></pre> <hr> <p><strong>EDIT:</strong> </p> <p>Without more code, it's difficult to see where you are using Null.<br> Are the table name and the column names correct?<br> What types are your variables? Do they really have values?<br> Can you post some more code where we can see how you declare and fill the variables?</p> <p>The "_" character indicates a line break. I could have written the whole statement in one line, but then you'd have to scroll to see it completely:</p> <pre><code>temp = DLookup("SKUS_ORDERED", "ORDER_DATA", "SKUS_ORDERED = '" &amp; curSKU2 &amp; "' and ORDER = " &amp; curOrder) </code></pre> <hr> <p><strong>EDIT 2:</strong> </p> <p>Could you show the parts where both variables are declared and where curSKU2 is initialized as well? With what you posted, one still can't see if curSKU2 is even filled and what types both are.</p> <p>Plus, <code>temp</code> is declared as string, so it can never be Null.<br> This has two consequences:</p> <ol> <li><code>If temp &lt;&gt; Null</code> doesn't make sense.</li> <li>DLookup returns Null when no record is found, so the type mismatch could be in the line <code>temp = DLookup(...)</code>.<br> Try <code>temp = Nz(DLookup(...))</code> instead.</li> </ol>
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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