E
efandango
I have a query which compares the current record's create time with the
previous record's create time, which gives me the number of seconds elapsed
between button presses. All works fine, except the first record is blank. I
want it to say either zero or 1 second, regardless of what the query say's.
This is the SQL (which creates a sub query from the exisitng table in order
to compare current with previous record.)
SELECT tbl_Waypoints_Reveal_Target.Run_No,
tbl_Waypoints_Reveal_Target.Run_waypoint_List_ID,
tbl_Waypoints_Reveal_Target.Run_waypoint,
tbl_Waypoints_Reveal_Target.Timer_pressed, (SELECT Dupe.Timer_pressed -
tbl_Waypoints_Reveal_Target.Timer_pressed
FROM tbl_Waypoints_Reveal_Target AS Dupe
WHERE Dupe.Run_waypoint_List_ID =
tbl_Waypoints_Reveal_Target.Run_waypoint_List_ID-1) AS Timer_Elapsed
FROM tbl_Waypoints_Reveal_Target
ORDER BY tbl_Waypoints_Reveal_Target.Run_No,
tbl_Waypoints_Reveal_Target.Run_waypoint_List_ID;
This is the query output.
Run_No Run_waypoint_List_ID Run_waypoint Timer_pressed Timer_Elapsed
40 2284 Main st 00:30:24
40 2285 South Road 00:30:26 00:00:02
40 2286 Peddle Lane 00:30:28 00:00:02
40 2287 Down St 00:30:30 00:00:02
previous record's create time, which gives me the number of seconds elapsed
between button presses. All works fine, except the first record is blank. I
want it to say either zero or 1 second, regardless of what the query say's.
This is the SQL (which creates a sub query from the exisitng table in order
to compare current with previous record.)
SELECT tbl_Waypoints_Reveal_Target.Run_No,
tbl_Waypoints_Reveal_Target.Run_waypoint_List_ID,
tbl_Waypoints_Reveal_Target.Run_waypoint,
tbl_Waypoints_Reveal_Target.Timer_pressed, (SELECT Dupe.Timer_pressed -
tbl_Waypoints_Reveal_Target.Timer_pressed
FROM tbl_Waypoints_Reveal_Target AS Dupe
WHERE Dupe.Run_waypoint_List_ID =
tbl_Waypoints_Reveal_Target.Run_waypoint_List_ID-1) AS Timer_Elapsed
FROM tbl_Waypoints_Reveal_Target
ORDER BY tbl_Waypoints_Reveal_Target.Run_No,
tbl_Waypoints_Reveal_Target.Run_waypoint_List_ID;
This is the query output.
Run_No Run_waypoint_List_ID Run_waypoint Timer_pressed Timer_Elapsed
40 2284 Main st 00:30:24
40 2285 South Road 00:30:26 00:00:02
40 2286 Peddle Lane 00:30:28 00:00:02
40 2287 Down St 00:30:30 00:00:02