DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  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




Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links