Exception error with date/time (Access 2000)

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Exception error with date/time (Access 2000)

    I am picking up a strange exception error for the following statement:

    If Rs.EOF OR DATEDIFF("d",rs("DateTime"),NOW()) Then
    '//
    End If

    Is there something wrong with my function







    Guest

  2. Similar Questions and Discussions

    1. Date/Time format with MS Access & CF
      Does anyone know of any workarounds regarding date/time format between MS Access and ColdFusion? Right now I have to set a column in my Access...
    2. MS Access time and date problem
      As the topic summary says, I am having trouble inserting both time and dates into a MS Access database. My database has three fields, eventdate,...
    3. date/time field from access 2000 db getting -1 in textbox on form
      I am stuck in using Access 2000 with on Windows 2000 server. I get a negitive 1 for a value. My code $DB_Conn = new...
    4. ASP SQL Server 2000 Date/Time Formating
      Hello, I have two questions which I would appreciate some help with. 1. Date Formating when Inserting into SQL Server 2000 I'm currently...
  3. #2

    Default Re: Exception error with date/time (Access 2000)

    [email]jason@catamaranco.com[/email] wrote:
    > I am picking up a strange exception error for the following statement:
    >
    > If Rs.EOF OR DATEDIFF("d",rs("DateTime"),NOW()) Then
    > '//
    > End If
    >
    > Is there something wrong with my function
    Two things:
    1. Datediff returns a number, not a boolean. While it won't cause an error,
    it's more correct (and less confusing) to use
    DATEDIFF("d",rs("DateTime"),NOW()) = 0

    2. vbscript does not do short-circuit (lazy) evaluation. Both boolean
    operands will be evaluated. If EOF is true, then the datediff will throw an
    error. You have to nest them:

    if not rs.eof then
    if DATEDIFF("d",rs("DateTime"),NOW()) = 0 then
    end if
    else
    end if

    [url]http://blogs.msdn.com/ericlippert/archive/2004/07/15/184431.aspx[/url]

    Bob Barrows
    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"


    Bob Barrows [MVP] Guest

  4. #3

    Default Re: Exception error with date/time (Access 2000)

    Thanks Bob....testing as we speak and also reading that cool blog along the
    way!

    - Jason
    "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
    news:%23zHADdPeEHA.3680@TK2MSFTNGP11.phx.gbl...
    > [email]jason@catamaranco.com[/email] wrote:
    > > I am picking up a strange exception error for the following statement:
    > >
    > > If Rs.EOF OR DATEDIFF("d",rs("DateTime"),NOW()) Then
    > > '//
    > > End If
    > >
    > > Is there something wrong with my function
    > Two things:
    > 1. Datediff returns a number, not a boolean. While it won't cause an
    error,
    > it's more correct (and less confusing) to use
    > DATEDIFF("d",rs("DateTime"),NOW()) = 0
    >
    > 2. vbscript does not do short-circuit (lazy) evaluation. Both boolean
    > operands will be evaluated. If EOF is true, then the datediff will throw
    an
    > error. You have to nest them:
    >
    > if not rs.eof then
    > if DATEDIFF("d",rs("DateTime"),NOW()) = 0 then
    > end if
    > else
    > end if
    >
    > [url]http://blogs.msdn.com/ericlippert/archive/2004/07/15/184431.aspx[/url]
    >
    > Bob Barrows
    > --
    > Microsoft MVP - ASP/ASP.NET
    > Please reply to the newsgroup. This email account is my spam trap so I
    > don't check it very often. If you must reply off-line, then remove the
    > "NO SPAM"
    >
    >

    Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139