Results 1 to 11 of 11

Thread: Here I go again........

  1. #1

    Thread Starter
    Fanatic Member spud's Avatar
    Join Date
    Aug 2000
    Location
    Munster (Germany)
    Posts
    542

    Here I go again........

    DATE frickin DATE!

    How do I [SELECT] from a database which contains dates starting from a year back from todays date.

    The date format I'm using is 11/01/2002

    Thx
    Haven't got anything to say that is the least bit interesting.
    www.tartan-underground.com

  2. #2
    PowerPoster
    Join Date
    Aug 2002
    Location
    NY, NY
    Posts
    2,139
    Oh, common. There is nothing to complaint about:
    VB Code:
    1. Private Sub Form_Load()
    2.     If DateDiff("yyyy", "11/01/2001", "11/01/2002") = 1 Then
    3.         MsgBox "This is just fine. ;-)"
    4.     End If
    5. End Sub
    Roy

  3. #3
    PowerPoster
    Join Date
    Aug 2002
    Location
    NY, NY
    Posts
    2,139
    Another variation:
    VB Code:
    1. Private Sub Form_Load()
    2.     If Year("11/01/2002") - Year("11/01/2001") = 1 Then
    3.         MsgBox "I will be just fine. ;-)"
    4.     End If
    5. End Sub
    Roy

  4. #4
    Addicted Member PhilRob56's Avatar
    Join Date
    Oct 2002
    Location
    New York
    Posts
    249
    Ummmmm.....

    VB Code:
    1. Dim dNow as Date
    2.  
    3. dNow = DateAdd("yyyy",-1, Date)
    4.  
    5. SELECT whatever FROM wherever WHERE [DateField] => " & dNow

    Yes? No?
    Some days you're the dog,
    and some days you're the hydrant.


    VB6 Enterprise

  5. #5

    Thread Starter
    Fanatic Member spud's Avatar
    Join Date
    Aug 2000
    Location
    Munster (Germany)
    Posts
    542
    Sorry IROY55 didn't explain myself again!

    Im using Data1.Recor....Select From.....etc. etc.... order by date

    Ive put the date to search into a text box by using [Date - 365] I think that is causing the problem as its not selecting dates over a year. More like 1 year and a couple of months...

    I think we have been here before IROY55
    Haven't got anything to say that is the least bit interesting.
    www.tartan-underground.com

  6. #6
    PowerPoster
    Join Date
    Aug 2002
    Location
    NY, NY
    Posts
    2,139
    That will do it as well.
    Roy

  7. #7

    Thread Starter
    Fanatic Member spud's Avatar
    Join Date
    Aug 2000
    Location
    Munster (Germany)
    Posts
    542
    PhilRob56 I think you could be onto somthing there...


    Thx
    Haven't got anything to say that is the least bit interesting.
    www.tartan-underground.com

  8. #8

    Thread Starter
    Fanatic Member spud's Avatar
    Join Date
    Aug 2000
    Location
    Munster (Germany)
    Posts
    542
    Thx Roy & PhilRob56 I'll go and try it.
    Haven't got anything to say that is the least bit interesting.
    www.tartan-underground.com

  9. #9
    Frenzied Member RudyL's Avatar
    Join Date
    Mar 2001
    Location
    Chicago
    Posts
    1,519
    you could do this..

    select [value] from [value]
    with recordset
    if!datexxx <= maxdate and !date >= mindate then add to list
    end with

    kinda sloppy, but you get teh drift - right?

    10 different ways to skin a cat and amazingly enough each and every one has the same result, the cat gets skinned! The same can be applied to code, so be nice and accept each others "preferences".

  10. #10

    Thread Starter
    Fanatic Member spud's Avatar
    Join Date
    Aug 2000
    Location
    Munster (Germany)
    Posts
    542
    yup
    Haven't got anything to say that is the least bit interesting.
    www.tartan-underground.com

  11. #11
    Addicted Member PhilRob56's Avatar
    Join Date
    Oct 2002
    Location
    New York
    Posts
    249
    Good Luck!
    Some days you're the dog,
    and some days you're the hydrant.


    VB6 Enterprise

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