title: Date Validation: Setting minimum and maximum date in a Textbox
body: <p>I have a function in my VBA code which sets a specific Date format for a textbox.</p>
  
  <p>This is my code to verify the Date is in the correct format:</p>
  
  <pre><code>Function CheckDate(DateStg As String) As Boolean
  
  If DateStg = "" Then
    ' Accept an empty value in case user has accidentally moved to a new row
    CheckDate = True
    lblMessage.Caption = ""
    Exit Function
  End If
  
  If IsDate(DateStg) Then
    CheckDate = True
    lblMessage.Caption = ""
  Else
    CheckDate = False
    lblMessage.Caption = "Sorry I am unable to recognise " &amp; DateStg &amp; " as a date."
  End If
  
  End Function
  </code></pre>
  
  <p>In addition to checking if the date in the textbox is an actual date, I need to verify that the textbox date is not less than the current date minus 1 month, and. Also, I would like to verify that the date is not more than the current date plus 1 year.</p>
  
  <p>So:   </p>
  
  <ul>
  <li>DateStg > Today - 1 month</li>
  <li>DateStg &lt; Today + 1 year</li>
  </ul>
  
  <p>Thanks for your help in advance.</p>