That is a little tricky to do.
The tricky part is matching up this row and the next row.
The SignIn time of the next row is the earliest time after the SignOut time of the current row.
If we knew the SignOut time, say X, then
Code:
SELECT MIN(SignIn)
FROM InAndOutBurger
WHERE SignIn > X
This means we look at every row with a SignIn time later than X, and the minimum value in all those rows is the next sign-in time. Every row offers a value for X, the SignOut time. And every row has a next row. Well just about every row.
We can fillin the value of X for each row this way
Code:
SELECT a.SignOut,
(SELECT MIN(SignIn)
FROM InAndOutBurger
WHERE SignIn > a.SignOut
) AS "NextSignIn"
FROM InAndOutBurger a
These two values can be used in a DATEDIFF() function.
It seems likely that you will be looking for these times for each one of a list of individuals so you will add a condition to the subquery.
Code:
SELECT a.burger_order_id, a.SignOut,
(SELECT MIN(SignIn)
FROM InAndOutBurger
WHERE SignIn > a.SignOut
AND burger_order_id = a.burger_order_id
) AS "NextSignIn"
FROM InAndOutBurger a
This will give you for example the time between completing the order and serving the burger.
I dont know whether Access has a facility for handling correlated subqueries. And this wont be fast even with a few dozen rows. If this is a high volume situation you may want to consider adding a column to your table for the next sign-in time and update it with the value whenever you insert a new row for the next sign-in.
While that might sound complicated it will pay off in performance and simplified reporting. For instance, the approach described by OhioSteve could be applied.