Results 1 to 4 of 4

Thread: URGENT: help what am i doing wrong! subtraction

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2003
    Posts
    134

    URGENT: help what am i doing wrong! subtraction

    Hey there,

    Everytime equation comes to zero my program runs into an infinate loop.. Anyone knows why... i'm actually subtracting one date from the other using date diff....

    my codes are as such

    VB Code:
    1. DateHold = Rs.Fields("TimeStamp")
    2.  
    3. Rs.MoveNext
    4.  
    5. Do While Not Rs.EOF
    6.  
    7.     DateCompare = Rs.Fields("TimeStamp")
    8.     Debug.Print DateCompare
    9.     Debug.Print DateHold
    10.     Subtract = DateDiff("s", DateHold, DateCompare)
    11.     Debug.Print Subtract
    12.     Rs!AmountTime = Subtract
    13.     DateHold = DateCompare
    14.     DateValidate = Rs.Fields("AmountTime")
    15.    
    16.     For i = 1 To 2000
    17.     DoEvents
    18.     Next i
    19.    
    20.     Debug.Print DateValidate
    21.    
    22.         If (DateValidate <= -1) Then
    23.                  
    24.             DeleteDateValidate (DateValidate)
    25.                  
    26.         End If
    27.        
    28.    Rs.MoveNext
    29.  
    30. Loop
    31.  
    32. Rs.Close
    33.  
    34.  
    35. Thanks!

  2. #2

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2003
    Posts
    134
    He thanks for the reply.. yes my code compiles...

    and these are my varibles

    Dim Subtract As String
    Dim AmountTime As String
    Dim DateCompare As Date
    Dim DateHold As Date
    Dim DateValidate As String

  4. #4
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385
    pnutz

    How is TimeStamp defined. Under normal conditions TimeStamp is a reservered field type and does not contain a date and is not defined as one.

    So DatDiff on a TimeStamp field would not be a correct choice.

Posting Permissions

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



Click Here to Expand Forum to Full Width