title: Compare date from form with date in table
body: <p>Building a booking system on Access 2016 I want to do some validation for a new booking to ensure the facility is available.  The problem I seem to be is comparing dates coming from the form with the dates in the table during the SQL.</p>
  
  <p>Here is some code to try and debug this:</p>
  
  <pre><code>    Set rst = CurrentDb.OpenRecordset("SELECT [FacBookID],[FacilityID],[EventDate] from FacilitiesBooking where [FacilityID] = " &amp; Me.Facilities.Column(0, facilitySelect))
      Debug.Print Me.Facilities.Column(0, facilitySelect) &amp; " | " &amp; Me.EventDate.Value &amp; " | " &amp; rst("FacilityID") &amp; " | " &amp; rst("EventDate") &amp; " | " &amp; rst("FacBookID")
      rst.Close
      Set rst = CurrentDb.OpenRecordset("SELECT [FacBookID] from FacilitiesBooking where ([FacilityID] = " &amp; Me.Facilities.Column(0, facilitySelect) &amp; " AND [EventDate] = " &amp; Me.EventDate.Value &amp; ")")
      If Not rst.EOF Then
          Debug.Print rst("FacBookID")
      Else
          Debug.Print "Did not find"
      End If
      rst.Close
  </code></pre>
  
  <p>When I run this with only one entry in the table and form data to match this entry I get:</p>
  
  <p>3 | 04/07/2016 | 3 | 04/07/2016 | 2</p>
  
  <p>Did not find</p>
  
  <p>This implies to me that I should get a record back from the second of the SQL statements but for some reason I do not.</p>
  
  <p>Apologies if this is something dumb but I have done a number of searches and tried different formatting methods for the date from the form.</p>