Date Comparison Issue 
Author Message
 Date Comparison Issue

This is an intresting one, that i can not figure out!

i have an application that assits in the tracking of public holidays!

to qualify for a holiday the employee must be employed for at Least 30 days!

to check this i do the following:
********************************************************************

datStatEligible = (DateAdd("D", (-30), gdatStat))
    If (rsEmployees.Fields("HireDate")) > CDate(datStatEligible) Then
        rsStat!DisqualifyCode = "HD"
        rsStat.Update

    Else
        ....code if employee has been around over 30 days!
    End If
********************************************************************
datStatEligible is declared as a date
gdatStat = date of stat, "JUL-01-2002"  in this case

what is weird is that if i message box to see what is in the
CDate(datStatEligible) i get 06/01/02 which is correct!
so any employees hired before this date, are eligible for the holiday!
on the computer where the application is installed it disqualifies ALL
Employees that were hired in 2002, irreguardless of the month and day?
on my computer it only disqualifies the 4 hired after June 1 / 2002
any ideas or comments!??

Mike



Mon, 20 Dec 2004 04:09:20 GMT  
 Date Comparison Issue
On Wed, 3 Jul 2002 16:09:20 -0400, "MTC"

Mike, I'm guessing your problem is that you're not Cdate()-ing the
database field.

However, why don't you use DateDiff instead  ?
If DateDiff("d", Now, rsEmployees.Fields("HireDate")) > 30 Then
        .. true

That should work fine and AFAIK takes care of any date format
mismatches.

Quote:
>This is an intresting one, that i can not figure out!

>i have an application that assits in the tracking of public holidays!

>to qualify for a holiday the employee must be employed for at Least 30 days!

>to check this i do the following:
>********************************************************************

>datStatEligible = (DateAdd("D", (-30), gdatStat))
>    If (rsEmployees.Fields("HireDate")) > CDate(datStatEligible) Then
>        rsStat!DisqualifyCode = "HD"
>        rsStat.Update

>    Else
>        ....code if employee has been around over 30 days!
>    End If
>********************************************************************
>datStatEligible is declared as a date
>gdatStat = date of stat, "JUL-01-2002"  in this case

>what is weird is that if i message box to see what is in the
>CDate(datStatEligible) i get 06/01/02 which is correct!
>so any employees hired before this date, are eligible for the holiday!
>on the computer where the application is installed it disqualifies ALL
>Employees that were hired in 2002, irreguardless of the month and day?
>on my computer it only disqualifies the 4 hired after June 1 / 2002
>any ideas or comments!??

>Mike

Regards, Frank


Mon, 20 Dec 2004 04:42:04 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Date - Date/time comparison - please help

2. String.Intern Comparison Issues.

3. Comparison of Dates in Find Operation

4. Date Comparison

5. Date Comparison in a Bubble Sort

6. ASP VBScript Date COMPARISON ??

7. date comparison query

8. Dates Comparison VB textbox to Access 95 (v7)

9. Dates Comparison VB textbox to Access 95 (v7)

10. Date Comparison VB variable / Now to Access V7.0

11. date comparison query

12. VB6 Deployment Wizard date/time comparison error?

 

 
Powered by phpBB® Forum Software