Returning data into table

S

Stan Smith

I have a very simple form that i want to use for measuring length of
telephone call. 3 text boxes on my form - Call_Start, Call_End and Duration,
same 3 fields in my Call_log table
On form Call_Start and Call_End are configured for Time and Duration has
Control Source =[Call_End]-[Call_Start]. Everything works fine on the form
with the correct length of time being displayed in Duration.
However when I look at the Table the fields for Call_Start and Call_End are
filled in but NOT the field for Duration.
No matter what I have tried so far I cannot get the duration of the call to
be reflected in the table???

Please save an old man his last bit of sanity!!!
MTIA
Stan
 
N

Nikos Yannacopoulos

Stan,

The reason why the duration is not stored in the table field is the control
on the form is unbound; setting its control source property to
=[Call_End]-[Call_Start] does the calculation as it should, but does not
allow you to bind the control to the table field. To do the latter, the
control source should be the table field, like the other two, but you can't
have both!
One way around it would be to make the control bound to the table field (so
you store the value), and use a different method for the calculation, such
as the use of a macro fired by the Before Update event of both the start and
end controls, with a SetValue action, item: Duration and expression:
=[Call_End]-[Call_Start]

BUT

This is not the best way to go! The duration should not be stored at all,
the table field is redundant. A piece of information that is so easy to
calculate on the basis of other existing information should not be stored,
it should be calculated on the fly whenever required.
Alternatively, you could store Call_Start and Duration only, dropping
Call_End from your table.

HTH,
Nikos
 

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