title: Date/time values in Dlookup (MS Access 2010) VBA
body: <p>Is there a difference in the type of date/time values that access uses in Dlookup commands?</p>
  
  <p>Example:
  Table <strong>tblreg</strong> with multiple records, having clientname (string) and regstart (string)
  Regstart is string but always uses the format dd-mm-yyyy hh:mm). This field can also have other values (depending on field typeindicator = &lt;>T)
  Query <strong>qry1</strong> points to table tblreg and contains <strong>reg1:Cdate(regstart)</strong> and typeindicator="T"</p>
  
  <p>The controls RegStart and Regstop are defined as string variables (same reason as table)</p>
  
  <p>VBA Code</p>
  
  <pre><code>Dim strOverlapClientName As String
  Dim date1, date2 As Date
  date1 = CDate(Me.RegStart)
  date2 = CDate(Me.RegStop)
  strOverlapClientName = DLookup("[ClientName]", 
                                 "qryRegOverlap", 
                                 "[Reg1]&lt;= #" &amp; date1 &amp; "# AND [Reg2]&gt;#" &amp; date1 &amp; "#")
  </code></pre>
  
  <p>Purpose: I want to query any existing clientname, where a new date/time registration overlaps an existing time registration of another client in the db.</p>
  
  <p>Checked value: <code>05-10-2014 12:55</code></p>
  
  <p>Error: the DLookup function returns an error code 94 (Invalid use of Null)</p>
  
  <p>Expected result should be 
  a client having RegStart 05-10-2014 12:00:00 and Regstop 05-10-2014 13:00:00</p>
  
  <p>Using a single criteria (e.g. "[Reg1]>= #" &amp; date1 &amp; "# ") does not throw an error, but returns a wrong record (02-01-2014 11:45:00)</p>
  
  <p>What am I doing wrong here?</p>
  
  <p>Art</p>