Limiting my query responses

G

Guest

I have a query that looks at a field containing a date and time (Availability
Goal). Based on the this information, I want the query to find the next
available departure time (departure schedule is a seperate table).

As it stands now, each departure in the table has a column for the day of
the week (1 being Sunday and 7 being Saturday) and a column for departure
time.

I want the query to look at the [Availability Goal] and either show me the
next departure for that day of the week, or the first departure on the
following day.

Currently I have a statement in the criteria line of the Departure Day that
reads:
IIf(TimeValue(Availability_Goal)>[Dep_Time], DatePart("w",
DateValue(Availability_Goal), 1), DatePart("w", DateAdd("w", 1,
Availability_Goal)))

This formula works to some extent, but it doesn't limit the query return to
just one item. For example, the availability time might be today at 10:00:00
PM, missing all of today's flights so I get a response of 3 possible flights
tomorrow.

Any help would be greatly appreciated.
 
S

Svetlana

Maybe you could use the First() function for your fields.
Meaning instead of [fields] in your query change them to
First([Fields])?
 

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