title: Access VBA & SQL date formats
body: <p>I'm having problems with date format in an SQL statement</p>
  
  <pre><code>CurrentTime = Format(CurrentTime, "dd/mm/yyyy hh:mm")
  SQL = "SELECT Count([ID]) AS Booked FROM [Appointment Slots] WHERE [Appointment Slots].Time=#" &amp; CurrentTime &amp; "#"
  </code></pre>
  
  <p>The bizarre thing here is that sometimes when I run the code this works.  Other times, and without changing the code, it doesn't, but then it works when I change the date format to mm/dd/yyyy hh:mm then it works for a while then stops working until I change it back to dd/mm/yyyy hh:mm</p>
  
  <p>Clearly something is going wrong with the regional date settings and how it's storing dates but I can't pin down a solution to this.  Is there no way to compare a date in Access SQL that is independent of format?</p>