Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2006
    Posts
    110

    Question Unanswered: Check if date field is before a set date

    I am trying to check if the date entered is before 12/15/2005, and if it is, then an error message shows. It is not working the way I have it written, but i am not getting a error on it. Any ideas?

    Thanks

    If Me.DATE_MAILED < 12 / 15 / 2005 Then
    MsgBox "Invalid Date"
    Me.Combo14.SetFocus
    Me.DATE_MAILED.SetFocus
    End If

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Try:

    if Me.DATE_MAILED < #12/15/2005# Then...
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    You may have noticed that Access separated the numbers 12, 15 and 2005 from the slashes. That was because what you were actually asking Access, cmays637, was is Me.Date_Mailed less than 12 divided by 15 divided by 2005! As Teddy pointed out, in code you always let Access know when you're designating a date by enclosing it in pound signs!
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •