R
red skelton via AccessMonster.com
Hi everyone,
I am doing a re-attack on a message I posted her a couple of weeks ago. I'm
still trying to make this query work but no luck. I have tried every
combination I can think of to get this query to run. What I currently have
is:
NextStart: (SELECT Min(Dupe.OR Start) FROM Table1 AS Dupe WHERE Dupe.OR Start
But I keep getting but keep getting the following message:
Syntex Error in query expression 'NextStart: (SELECT Min(Dupe.OR Start) FROM
Table1 AS Dupe WHERE Dupe.OR Start > Table1.TimeOutOfOR AND = Dupe.OR# AND
Table1.OR#)'
All I'm trying to do with query is to pull the next OR Start time.
It is probably something very obvious but after looking at it for awhile, I
cant see where the problem is. Any help would be greatly appreciated.
VR,
Red
Here is the original postings:
Hi everyone,
I'm having a problem with a query. I have two times, a TimeFinished and a
TimeStart. The senerio is that I have a room that could be used multiple
times during a day. What I'm trying to do with my query is see how much time
in minutes elapse it takes from the time a group finishes using the room
until the next group starts using the room. In my table, these two times are
on two seperate records as they are two seperate entities. For example;
TimeFinish is 0900 (when the first group leave the room) This information is
included in one record
TimeStart is 0945 (when the next group starts to use room) This infromation
is from the next record
The time I'm trying to pull from my query is 45 minutes. I tried to use
DateDiff("n",[TimeFinished],[TimeStart]) but all I get is an error. (FYI
Time start is a text field and TimeFinished is a date/Time field) Hope this
makes sense and appreciate any help in advance.
VR,
Red
Reply to this message
Allen Browne - 01-19-2006 16:04
Use a subquery to get a value from another record in the same table.
Type something like this into a fresh column in the Field row of your query,
replacing "Table1" with the name of your table:
NextStart: (SELECT Min(Dupe.[TimeStart]) FROM Table1 AS Dupe
WHERE Dupe.TimeStart >= Table1.TimeFinished
AND Dupe.RoomID = Table1.RoomID)
Once you have that working, you can extend it so it calculate the minutes
gap rather than the next start time:
MinutesGap: DateDiff("n", Table1.TimeFinished,
(SELECT Min(Dupe.[TimeStart]) FROM Table1 AS Dupe
WHERE Dupe.TimeStart >= Table1.TimeFinished
AND Dupe.RoomID = Table1.RoomID))
I am doing a re-attack on a message I posted her a couple of weeks ago. I'm
still trying to make this query work but no luck. I have tried every
combination I can think of to get this query to run. What I currently have
is:
NextStart: (SELECT Min(Dupe.OR Start) FROM Table1 AS Dupe WHERE Dupe.OR Start
Table1.TimeOutOfOR AND = Dupe.OR# AND Table1.OR#)
But I keep getting but keep getting the following message:
Syntex Error in query expression 'NextStart: (SELECT Min(Dupe.OR Start) FROM
Table1 AS Dupe WHERE Dupe.OR Start > Table1.TimeOutOfOR AND = Dupe.OR# AND
Table1.OR#)'
All I'm trying to do with query is to pull the next OR Start time.
It is probably something very obvious but after looking at it for awhile, I
cant see where the problem is. Any help would be greatly appreciated.
VR,
Red
Here is the original postings:
Hi everyone,
I'm having a problem with a query. I have two times, a TimeFinished and a
TimeStart. The senerio is that I have a room that could be used multiple
times during a day. What I'm trying to do with my query is see how much time
in minutes elapse it takes from the time a group finishes using the room
until the next group starts using the room. In my table, these two times are
on two seperate records as they are two seperate entities. For example;
TimeFinish is 0900 (when the first group leave the room) This information is
included in one record
TimeStart is 0945 (when the next group starts to use room) This infromation
is from the next record
The time I'm trying to pull from my query is 45 minutes. I tried to use
DateDiff("n",[TimeFinished],[TimeStart]) but all I get is an error. (FYI
Time start is a text field and TimeFinished is a date/Time field) Hope this
makes sense and appreciate any help in advance.
VR,
Red
Reply to this message
Allen Browne - 01-19-2006 16:04
Use a subquery to get a value from another record in the same table.
Type something like this into a fresh column in the Field row of your query,
replacing "Table1" with the name of your table:
NextStart: (SELECT Min(Dupe.[TimeStart]) FROM Table1 AS Dupe
WHERE Dupe.TimeStart >= Table1.TimeFinished
AND Dupe.RoomID = Table1.RoomID)
Once you have that working, you can extend it so it calculate the minutes
gap rather than the next start time:
MinutesGap: DateDiff("n", Table1.TimeFinished,
(SELECT Min(Dupe.[TimeStart]) FROM Table1 AS Dupe
WHERE Dupe.TimeStart >= Table1.TimeFinished
AND Dupe.RoomID = Table1.RoomID))