division by zero when looking at date


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: division by zero when looking at date

  1. #1
    ted k Guest

    division by zero when looking at date


    Hi,
    I am using the following sql statement to find a record where todays date
    matches the date in the date field. If the table is empty, there is no problem.
    However, if there is a record in the table, I get a "division by zero" error
    (the date reads 6/29/00)when the rsclock.open statement is reached.
    What can I do?

    rsClock.Source = "select * from timeclock where ID = " & intEmpID & "
    And date = " & theDate
    rsClock.CursorType = adOpenStatic
    rsClock.LockType = adLockOptimistic
    rsClock.ActiveConnection = "Provider=Microsoft.Jet.Oledb.4.0;Data Source
    =" & config.ddrive & ":\pdq_new\staff.mdb;"
    rsClock.Open Options:=adCmdText

    thanks, Ted

  2. #2
    Jason Langston Guest

    Re: division by zero when looking at date

    Ted,
    In MS Access you have to tell Access that you're passing a date value not
    trying to divide two numbers. You do this by surrounding the date value with
    # signs :
    "SELECT .... WHERE .... AND date = #" & theDate & "#"
    HTH,
    -JasonL
    ted k <tkirkendal@aol.com> wrote in message news:395cc2d1$1@news.devx.com...
    >
    > Hi,
    > I am using the following sql statement to find a record where todays date
    > matches the date in the date field. If the table is empty, there is no

    problem.
    > However, if there is a record in the table, I get a "division by zero"

    error
    > (the date reads 6/29/00)when the rsclock.open statement is reached.
    > What can I do?
    >
    > rsClock.Source = "select * from timeclock where ID = " & intEmpID & "
    > And date = " & theDate
    > rsClock.CursorType = adOpenStatic
    > rsClock.LockType = adLockOptimistic
    > rsClock.ActiveConnection = "Provider=Microsoft.Jet.Oledb.4.0;Data

    Source
    > =" & config.ddrive & ":\pdq_new\staff.mdb;"
    > rsClock.Open Options:=adCmdText
    >
    > thanks, Ted




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center