Time/Date

K

Kalvy

If anyone can help, it's greatly appreciated. I am trying to retrieve a
specific time for each flight that is betwen two time dates in a table. The
query below retreives the same departuretime for each flight, I do not know
why.
First query:
Departure: IIf([Flight date] Between [from] And [to],[departuretime],0)

The table contains these columns:
FlightNum orig Dest From To DepartureTime
NK100 FLL SXM 2/9/2009 2/15/2009 10:50:00 AM
NK100 FLL SXM 2/16/2009 2/22/2009 11:50:00 AM

If the flight date is 2/19/2009, then it should return 11:50:00 AM.
 
S

Skip

Does this work for you?
SELECT [DepartureTime] from [Table1] WHERE [FlightDate] BETWEEN [FromDate]
AND [ToDate]

Where your table is [Table1], [FromDate] is your [from] (using 'from' as a
field name made me nervous) and [ToDate] is your [to] field. The query
prompts you for [FlightDate]
 
K

Kalvy

Hi Skip, sorry I am a newbie in using Access. I tried to impliment your
suggestion but I'm not quite sure I understand. Should I select
DepartureTime and in the criteria field use WHERE [FlightDate] BETWEEN
[FromDate]
AND [ToDate]? I tried but it failed to launch data. Perhaps I should explain what I am trying to accomplish. I have 2 queries. One with flight data information such as flight numbers, origins, destinations, flight date, ect. The other table contains the flight numbers, origin, destinations and time periods where the flight may depart at different intervals, the second query's info below:
FlightNum orig Dest From To DepartureTime
I need to provide a list of all flight numbers with there origin,
destination and depending on the flight date, the departure time. So the
final data should contain
Flt #, Origin, Destination, Flt date, and departure(departure is determined
if flight date is >= from and <= to). Hence, I came up with an IIf statement
(Departure: IIf([Flight date] Between [from] And [to],[departuretime],0).
The data returns 12:00:00am for all items. What am I doing wrong?


Skip said:
Does this work for you?
SELECT [DepartureTime] from [Table1] WHERE [FlightDate] BETWEEN [FromDate]
AND [ToDate]

Where your table is [Table1], [FromDate] is your [from] (using 'from' as a
field name made me nervous) and [ToDate] is your [to] field. The query
prompts you for [FlightDate]


Kalvy said:
If anyone can help, it's greatly appreciated. I am trying to retrieve a
specific time for each flight that is betwen two time dates in a table.
The
query below retreives the same departuretime for each flight, I do not
know
why.
First query:
Departure: IIf([Flight date] Between [from] And [to],[departuretime],0)

The table contains these columns:
FlightNum orig Dest From To DepartureTime
NK100 FLL SXM 2/9/2009 2/15/2009 10:50:00 AM
NK100 FLL SXM 2/16/2009 2/22/2009 11:50:00 AM

If the flight date is 2/19/2009, then it should return 11:50:00 AM.
 
K

Kalvy

Any ideas or help will be appreciated.

Thanks in advance.

Kalvy said:
Hi Skip, sorry I am a newbie in using Access. I tried to impliment your
suggestion but I'm not quite sure I understand. Should I select
DepartureTime and in the criteria field use WHERE [FlightDate] BETWEEN
[FromDate]
AND [ToDate]? I tried but it failed to launch data. Perhaps I should explain what I am trying to accomplish. I have 2 queries. One with flight data information such as flight numbers, origins, destinations, flight date, ect. The other table contains the flight numbers, origin, destinations and time periods where the flight may depart at different intervals, the second query's info below:
FlightNum orig Dest From To DepartureTime
I need to provide a list of all flight numbers with there origin,
destination and depending on the flight date, the departure time. So the
final data should contain
Flt #, Origin, Destination, Flt date, and departure(departure is determined
if flight date is >= from and <= to). Hence, I came up with an IIf statement
(Departure: IIf([Flight date] Between [from] And [to],[departuretime],0).
The data returns 12:00:00am for all items. What am I doing wrong?


Skip said:
Does this work for you?
SELECT [DepartureTime] from [Table1] WHERE [FlightDate] BETWEEN [FromDate]
AND [ToDate]

Where your table is [Table1], [FromDate] is your [from] (using 'from' as a
field name made me nervous) and [ToDate] is your [to] field. The query
prompts you for [FlightDate]


Kalvy said:
If anyone can help, it's greatly appreciated. I am trying to retrieve a
specific time for each flight that is betwen two time dates in a table.
The
query below retreives the same departuretime for each flight, I do not
know
why.
First query:
Departure: IIf([Flight date] Between [from] And [to],[departuretime],0)

The table contains these columns:
FlightNum orig Dest From To DepartureTime
NK100 FLL SXM 2/9/2009 2/15/2009 10:50:00 AM
NK100 FLL SXM 2/16/2009 2/22/2009 11:50:00 AM

If the flight date is 2/19/2009, then it should return 11:50:00 AM.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top