date comparisons 
Author Message
 date comparisons

no, not if your woman is sexier than mine, but...

How does one go about comparing dates in VB? Precisely, I would like to get
today's date, then check it against a date in a database field(lets say
"date" field) if the field is more than 6 months older than todays date, I
want to data1.delete

first, I would like to know how to get todays date from the computer.

Then I would like to compare that to the field "date", if it is greater than
6 months, do something with it(delete)

-BN-
thanks in advance.....



Wed, 25 Jul 2001 03:00:00 GMT  
 date comparisons
There are several functions which return the current date.  "Now" is one of
them.  The DateDiff function returns the number of specified periods between
two dates.  The following code does what you want:

    Dim dtOld As Date
    dtOld = <the date from the table field>
    If DateDiff("m", dtOld, Now) > 6 Then
        Data1.Delete
    End If

Lee Weiner
weiner AT fuse DOT net



Quote:
>no, not if your woman is sexier than mine, but...

>How does one go about comparing dates in VB? Precisely, I would like to get
>today's date, then check it against a date in a database field(lets say
>"date" field) if the field is more than 6 months older than todays date, I
>want to data1.delete

>first, I would like to know how to get todays date from the computer.

>Then I would like to compare that to the field "date", if it is greater than
>6 months, do something with it(delete)

>-BN-
>thanks in advance.....



Wed, 25 Jul 2001 03:00:00 GMT  
 date comparisons
Look in the help files for:

Now
DateDiff

Mike

Quote:

>no, not if your woman is sexier than mine, but...

>How does one go about comparing dates in VB? Precisely, I would like to get
>today's date, then check it against a date in a database field(lets say
>"date" field) if the field is more than 6 months older than todays date, I
>want to data1.delete

>first, I would like to know how to get todays date from the computer.

>Then I would like to compare that to the field "date", if it is greater
than
>6 months, do something with it(delete)

>-BN-
>thanks in advance.....



Wed, 25 Jul 2001 03:00:00 GMT  
 date comparisons
Thanks, I have learning edition, and the documentation is, uh, well its
pretty much not there. I bought VB6 for dummies and flew through it, and it
was pretty basic, and then bought beginning VB6 database programming, and
that helped greatly, to a point.

Basically what I am saying is the microsoft documentation sucks, and they
only list their own titles as recommended reading.

-BN-

Quote:

>no, not if your woman is sexier than mine, but...

>How does one go about comparing dates in VB? Precisely, I would like to get
>today's date, then check it against a date in a database field(lets say
>"date" field) if the field is more than 6 months older than todays date, I
>want to data1.delete

>first, I would like to know how to get todays date from the computer.

>Then I would like to compare that to the field "date", if it is greater
than
>6 months, do something with it(delete)

>-BN-
>thanks in advance.....



Wed, 25 Jul 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Date Comparison

2. Date Comparison in a Bubble Sort

3. ASP VBScript Date COMPARISON ??

4. date comparison query

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

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

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

8. date comparison query

9. Date Comparison Issue

10. Confused over Date comparisons

11. Date comparisons not working?

12. Help! Date comparison problem

 

 
Powered by phpBB® Forum Software