Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 131,625 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 2,214 people online right now. Registration is fast and FREE... Join Now!




date picker

 
Reply to this topicStart new topic

date picker, finding two dates after the chosen date

emkaye
post 12 Aug, 2008 - 05:06 AM
Post #1


D.I.C Head

**
Joined: 12 Aug, 2007
Posts: 53


My Contributions


i have a datepicker used for searching available flights. if there were no available flights for the chosen date, then, the program would look for another dates with available flights. these "another dates" should be two dates after the chosen date. but i don't know how to code it. pls.help...

Below is the only code i know...
CODE

        AvailableFlight = "SELECT * FROM tblFlightDet WHERE ORIGIN = '" & cboFrom.Text & "' AND DESTINATION = '" & cboTo.Text & "' AND JOUR_DATE = #" & DTPicker1.Value & "# AND NO_SEATS >= " & Str(Val(TotalPassenger))
        Set AvailableFlightRS = myConn.Execute(AvailableFlight)


tnx
User is offlineProfile CardPM

Go to the top of the page


ertan2002
post 13 Aug, 2008 - 04:38 PM
Post #2


New D.I.C Head

*
Joined: 13 Aug, 2008
Posts: 4

hi, you can datediff's funciton

using datediff;

X = datediff (time,date1,date2)


for example:

CODE

dim totaldays ,olddate

oldate = "12.08.2005"

totaldays = datediff("d",now,olddate)



you can use other time

IPB Image

This post has been edited by ertan2002: 13 Aug, 2008 - 04:40 PM
User is offlineProfile CardPM

Go to the top of the page

AdamSpeight2008
post 13 Aug, 2008 - 05:02 PM
Post #3


LINQ D.I.C.

Group Icon
Joined: 29 May, 2008
Posts: 749



Thanked 48 times

Dream Kudos: 2025
My Contributions


try
sql

SELECT ... FROM ... WHERE (flightdate BETWEEN (chosendate) AND (chosendate +2))
User is online!Profile CardPM

Go to the top of the page

thava
post 13 Aug, 2008 - 05:11 PM
Post #4


D.I.C Regular

Group Icon
Joined: 17 Apr, 2007
Posts: 423



Thanked 17 times

Dream Kudos: 50
My Contributions


add the following code

CODE

if AvailableFlightRS.eof then
AvailableFlight = "SELECT * FROM tblFlightDet WHERE ORIGIN = '" & cboFrom.Text & "' AND DESTINATION = '" & cboTo.Text & "' AND JOUR_DATE > #" & DTPicker1.Value & "# AND JOUR_DATE < #" & dateadd("d",2,DTPicker1.Value) & "# AND NO_SEATS >= " & Str(Val(TotalPassenger))
        Set AvailableFlightRS = myConn.Execute(AvailableFlight)
end if
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/20/08 05:10AM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month