Results 1 to 9 of 9
  1. #1
    Join Date
    May 2006
    Posts
    178

    Unanswered: Why is 31/12/2009 > 01/01/2010 ?

    Hi,

    I have a date question. I have a start and finish date. A msgbox pops up when the finish date is greater than start date.

    if [SDate] > [FDate] then
    Msgbox "blah blah"

    However when i use 31/12/2009 as a start date and finish date as 01/01/2010 i get the msg box pop up.

    Any ideas?

    Thanks

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    What is the data type of the fields? Sounds like they're being treated as text (3 is greater than 0).
    Paul

  3. #3
    Join Date
    May 2006
    Posts
    178
    Hi Baldy

    The format of the txtbox is short date and the input mask if its any help is 00/00/000;0;_


    any ideas?

  4. #4
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    I'm looking for the data type in the table, presuming it's a bound textbox. You could try

    if CDate([SDate]) > CDate([FDate]) then

    to force the issue.
    Paul

  5. #5
    Join Date
    May 2006
    Posts
    178
    Hi Baldy,

    The text box is unbound. im trying to validate it before it gets into the table.

    Aboo

  6. #6
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    So did you try what I suggested?
    Paul

  7. #7
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    the test / string value of 3 is greater than 0
    as Pbaldy suggests you need to make sure you are comparing dates not text/string
    I'd rather be riding on the Tiger 800 or the Norton

  8. #8
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    See post 4!
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  9. #9
    Join Date
    May 2006
    Posts
    178
    Thanks Baldy!!! your a genius

    Works a treat!

    Aboo

Posting Permissions

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