title: Access VBA Compare dates not working
body: <p>I am having trouble comparing dates. The if statement in my code is saying the endDate is not less even though it is. For example, if the endDate is 2/20/2017 and startDate 2/22/2017 the if statement says endDate is not lest but it is.</p>
  
  <pre><code>    Dim startDate As Date
      Dim endDate As Date
  
          startDate = DateValue(Me.dueDateTxt)
          endDate = DateValue(Me.shippedDate)
  
          If (endDate &lt; startDate) Then
              Debug.Print "It is less"
          Else
              Debug.Print "not less"
          End If
  </code></pre>
  
  <p>I have also tried </p>
  
  <pre><code>    If Me.dueDateTxt &lt; Me.ShippedDate Then
      If CDate(startDate) &lt; CDate(endDate) Then        
      If Format(startDate, "mm/dd/yyyy") &lt; Format(endDate, "mm/dd/yyyy") Then
      If DateDiff(d, startDate, endDate) &gt; 0 Then
  </code></pre>
  
  <p>I am missing something somewhere thank you in advance for the help!</p>
  
  <p>EDIT: I figured out what the problem was. I have a function to eliminate holidays and weekends. That function was swaping my startDate and endDate. Thank you everyone for your help and suggestions.</p>