Re: Guidance on entering and display date & time
- From: John W. Vinson <jvinson@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 04 Jun 2008 15:36:38 -0600
On Wed, 4 Jun 2008 07:39:05 -0700, RichKorea
<RichKorea@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
I?m putting together a service database that uses a form based on a query for
the data input and display. I need to track when the call came in for
service, when the work started, and when the work was completed. My plan is
to use the three date/time values when preparing a report to calculate how
long it took to show up from when the call came in, and how long it took to
do the repair.
I?m thinking I want three fields in the table (Call, Arrive, and Finish).
There would be two combo boxes (one for the date and one for the time) for
each field, such that the user can enter the date and the time (or change the
date or time), and the values would then combine for saving in the field.
When displaying a record, the reverse would need to happen.
Is there a sample database or explanation on Microsoft.com that provides
guidance on how to handle dates and time?
One other question ? the Active X calendar in Access works great for
entering the date. Is there something similar for entering the time?
Thanks,
Rich
Dave's absolutely right: do NOT use separate textboxes for the date and time,
it just makes things harder, not simpler.
I wouldn't require the user to type either. Depending on how you are entering
the record, you could either set the Default Value of the field to =Now() to
fill in the date and time the instant a record is started (this would probably
be appropriate for the Call field); or use a single line of easy VBA code in
the textbox's DoubleClick event:
Private Sub txtArrive_DoubleClick()
Me!txtArrive = Now
End Sub
where txtArrive is the name of the textbox bound to the Arrive field. The user
can still overtype it if needed (and if that's permissible...!).
You can easily calculate the time on site etc. using the DateDiff() function
in your report, or in the query upon which you base the report.
--
John W. Vinson [MVP]
.
- Follow-Ups:
- Re: Guidance on entering and display date & time
- From: RichKorea
- Re: Guidance on entering and display date & time
- Prev by Date: Re: Saving changes to a form
- Next by Date: Re: duplex printing a report , second page upside down
- Previous by thread: Re: Saving changes to a form
- Next by thread: Re: Guidance on entering and display date & time
- Index(es):
Relevant Pages
|