Results 1 to 16 of 16

Thread: Listing Data between two Dates

Hybrid View

  1. #1
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: Listing Data between two Dates

    This is probably the harder way to do this.
    VB Code:
    1. While not Found and not tblBooking.EOF
    2.    If tblBooking!Date >= startate and If tblBooking!Date <=EndDate then
    3.       Do what you want here
    4.    end if
    5.    tblBooking.MoveNext
    6. Wend
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  2. #2

    Thread Starter
    Member
    Join Date
    Dec 2005
    Posts
    33

    Re: Listing Data between two Dates

    Quote Originally Posted by GaryMazzone
    This is probably the harder way to do this.
    VB Code:
    1. While not Found and not tblBooking.EOF
    2.    If tblBooking!Date >= startate and If tblBooking!Date <=EndDate then
    3.       Do what you want here
    4.    end if
    5.    tblBooking.MoveNext
    6. Wend
    That can't work because startDate and endDate is just the number for the day, not the full date!

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2005
    Posts
    33

    Re: Listing Data between two Dates

    Because the interval should be a week between the dates i want to retrieve, I added this to your code

    VB Code:
    1. startDate = DatePart("d", dtpStartDate)
    2. endDate = startDate + 7
    3. monthNumber = DatePart("mm", dtpStartDate)
    4. yearNumber = DatePart("yyyy", dtpStartDate)
    5.  
    6. fullSDate = startDate + "/" + monthNumber + "/" + yearNumber
    7. fullEDate = endDate + "/" + monthNumber + "/" + yearNumber
    8.  
    9. full
    10.  
    11.     While Not found And Not tblBooking.EOF
    12.        If tblBooking!Date >= fullSDate And tblBooking!Date <= fullEDate Then
    13.             Print "wow"
    14.        End If
    15.             tblBooking.MoveNext
    16.     Wend

    Hopefully that could work?

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