title: Using Variables in Dfunction VBA
body: <pre><code>Y = DMax("[ID]", "Table1", "Len(date) = 0")
  A = DMin("[ID]", "Table1", "Len(date) &gt; 0")
  B = DLookup("[Duration]", "Table1", "[ID] = [Y]")
  C = DLookup("[Due_date]", "Table1", "[ID] = [A]")
  E = [C] - [B]
  </code></pre>
  
  <p>Variable B errors out. (And then C and E would as well) Is there a way to use Y in my criteria for variable B?</p>
  
  <p>Much appreciated!</p>