OK, Marshall
Here goes...
the scenario:
I have 2 forms.
the 2nd form is used for revealing a sequence of records which happen to be
addresses. (this is for a memorizing test).
The 1st form is used to execute the 'reveal' action on the first form,
whereby the reveal button goes through each record in the form's record
source and copies the record to the other form's corresponding 'empty'
fields, thereby creating a gradual 'reveal' of the address list on the second
form.
the 1st form's reveal button uses this code to copy the record:
If IsNull(Forms.frm_Runs.[frm_Waypoints_Reveal_Target].Form.[Run_waypoint])
Then
Forms.frm_Runs.[frm_Waypoints_Reveal_Target].Form.[Run_waypoint] =
Me.Run_waypoint
Forms.frm_Runs.[frm_Waypoints_Reveal_Target].Form.[Run_Direction] =
Me.Run_Direction
DoCmd.GoToRecord , , acNext
this all works fine.
the 2nd form's record source is this:
SELECT tbl_Waypoints_Reveal_Target.Run_waypoint_List_ID,
tbl_Waypoints_Reveal_Target.Run_No,
tbl_Waypoints_Reveal_Target.Run_Direction,
tbl_Waypoints_Reveal_Target.Run_waypoint,
tbl_Waypoints_Reveal_Target.Timer_pressed,
Format(DLookUp("Timer_Elapsed","QRY_Run_Reveal_Timings","Run_waypoint_List_ID
= " & [Run_waypoint_List_ID]),"ss") AS Elapsed FROM
tbl_Waypoints_Reveal_Target ORDER BY
tbl_Waypoints_Reveal_Target.Run_waypoint_List_ID;
Which all works fine.
But then I wanted to add a feature that would time how long it took the user
to ask for the next reveal
so I used another query called:
QRY_Run_Reveal_Timings
which is this:
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;
Which utilises this line and its particular DLookup reference for my 2nd
form's SQL to enable me to get the timings for the form field,[Elapsed]
Elapsed:
Format(DLookUp("Timer_Elapsed","QRY_Run_Reveal_Timings","Run_waypoint_List_ID
= " & [Run_waypoint_List_ID]),"ss")
that is the framework, and all works fine, except because of the way that
the timings work; eg: compare the current record's now() time to the previous
record's now() time, gives me the first record as being a very high and
undesirable figure, because the user may spend an inordinate amount of time
geeting their head together before beginning the reveal process, so I would
rather it was set to either 1 sec, as it is only the 2nd and subsequent
records (& timings) that will matter.
I hope this makes some sense and that you can help with a solution.
regards
Eric
Marshall Barton said:
Apparently I did not correctly decode what you're trying to
do. I suggest that you explain your question in terms of
the relevant variables, controls, tables and fields you have
along with how they relate to each other.
--
Marsh
MVP [MS Access]
I get this error message:
'Field is based on an expression and cannot be edited
this is the field's expression:
Elapsed:
Format(DLookUp("Timer_Elapsed","QRY_Run_Reveal_Timings",
"Run_waypoint_List_ID = " & [Run_waypoint_List_ID]),"ss")
is there another way of doing this?
:
efandango wrote:
How can I set the value for the first record of a recordset?
I want to set the value of the first recorde to 1. all records thereafter
will use the Now() time field for their values.
This is for a form that logs the time (in seconds) each time a new record is
created; but the problem is that if the user waits too long before creating
the first record, I get, for example a value of 25 seconds, which is too
long, so i would prefer if it was just given the value of 1 (second).
I don't mind if the first record has the real value at first, and is then
overwritten with the value of '1'.
Use your form's BeforeUpdate event. If I have correctly
decoded what you're trying to do, try something like:
Static dtPreviousTime As Date
If Me.RecordsetClone.RecordCount = 0 Then
Me.timefield =TimeSerial(0,0,1)
Else
Me.timefield = DateDiff("s", dtPreviousTime, Time)
End If
dtPreviousTime = Time