Easy Time Entry on a form?? Help.

J

Jeff C

I am working on a project that is requiring many date and time fields.
From these I will be building queries that will be calculating
different elapsed time values. In the past I have used a pop up
calendar making the entry of a date quicker/easier. Has anybody come
up with a tool that does the same with time?

My fields are formatted as a general date and on my data entry form I
customized an input mask to take the full date and military time
entries, it just results in alot of repetative entry when in most cases
everything happens on the same day. However on those occasions when
the data covers time before and after midnight it is necessary.

I appreciate any thoughts or ideas/solutions.

Thank you
 
S

Simon Glencross

I use the MS Date and Time picker this can be found by opening a form in
design view select Insert, Active X Control, Microsoft Date and Time Picker
Control 6.0

Have a look and see what you think.

HTH

S
 
G

Guest

Thanks for your reply, I looked at that but could not get anything but a
calendar for the date to show up.

I have used Allen Browne's Calendar Control extensively in just about every
tool I have built but cannot find a clock control. Date and Time picker has
one? Are there problems with that control?

If I found the controls I was thinking of assigning a command button to run
update queries on all the date and time fields one at a time as the data is
entered. One button for field 1, oanother for field 2 etc.

Thanks for your ideas
 
V

Van T. Dinh

I use the DateTime Picker Control regularly without any problem.

If you want, post your email address and I send you a database with a a Form
using the Calendar Control for date-component value and a DateTime Picker
Control for time-component value.
 
G

Guest

Hello! My situation is almost exactly like what JeffC described. I have
several fields that require both date and time to be entered, and it would be
nice if I could provide a calendar tool to make data entry easier.

Would you be able to forward me that zip file you sent Jeff? Or point me to
a website or two that have date and time pickers?

techgeek1234 at hotmail.com

Thank you!
 
V

Van T. Dinh

Here the code I use to call the Form "frmDTPicker" for a Control
[txtDateFrom]:

********
Private Sub cmdFromDateCal_Click()

On Error GoTo cmdFromDateCal_Click_Err
With Me
If (IsDate(.txtDateFrom)) Then
' The first part (before ";" is the date/time to set the initital
value
' and the second part is the Caption to be used for the "frmDTPicker"
DoCmd.OpenForm gDTPICKERFORM, , , , , acDialog, _
Format(.txtDateFrom, "yyyy\-mm\-dd\ hh\:nn\:ss") & _
";Select Start Date/Time"
Else
DoCmd.OpenForm gDTPICKERFORM, , , , , acDialog, _
";Select Start Date/Time"
End If

' Back from the acDialog Calendar
If (CurrentProject.AllForms(gDTPICKERFORM).IsLoaded = True) Then
.txtDateFrom = Forms(gDTPICKERFORM).acxCalendar + _
Forms(gDTPICKERFORM).acxTimePicker
DoCmd.Close acForm, gDTPICKERFORM, acSaveNo

Call txtDateFrom_AfterUpdate
End If
End With

cmdFromDateCal_Click_Exit:
On Error Resume Next
Exit Sub

cmdFromDateCal_Click_Err:
Select Case Err.Number
Case 0
Case Else
MsgBox "Error " & Err.Number & ": " & Err.Description & vbCrLf &
vbCrLf & _
"(Programmer's note:
Form_frmProductionEntry_ByDay.cmdFromDateCal_Click)", _
vbOKOnly + vbCritical, "Run-time Error!"
End Select
Resume cmdFromDateCal_Click_Exit
End Sub
********

Watch out for line-wrapping due to posting ...
 
V

Van T. Dinh

See comments in line.

--
HTH
Van T. Dinh
MVP (Access)



Tech Geek 1234 said:
Thank you for the info (and reminder about wrapping in posts). I've put
the
code in and changed the necessary names to match my names. I am getting
an
error msg "Error 2494: The action or method requires a Form Name
argument."
When I comment out the "on error" statement, the vb debugger points to the
first If paragraph - not that that helps pinpoint the problem! I have
some
thoughts and the code below if you would be able to continue helping me!
:)

1) Am I missing a form name or something? I noticed the name you put in
the
posting and the form name within the code are different, one begins with
"g".
I just put in the form name as I have it in the Access database window.
Do
I need to do something different, like declare a form object, or specify
it
or something?
Yes, I use the [frmDTPicker] at numerous places so I use a global constant
declared in a standard module. This way, if for some reason, I need to
change the name of the Form [frmDTPicker], I only need to change in one
place in code.



2) Also, I noticed that the txtDateFrom data is being formatted; do I need
this step? If so, do I need to move the "yyyy" to the end of the date as
that's how I have it in the field to begin with?
Leave the Format alone. That is how the [frmDTPicker] expects it. If you
want to change, you need to modify the code in the [frmDTPicker] also.



3) You Call txtDateFrom_AfterUpdate; do I need this or can I comment it
out?
I don't know what's in that procedure. I have it commented out for now.
Yes. It is for the processing that I need to do if the date value is
changed. You can comment it out if you don't need "automatic" processing as
soon as the date value is changed.




4) Also - I can open the calendar form itself fine and use the calendar
and.
But just in case, do I need to be running a version of Access or have the
control installed on my machine? (I am running 2003 - but my company
probably has the version defaulted to 2000 or something to keep us all
using
the same version of databases.)
Access 2000 also has the Calendar Control but different version. You need
to change the References of the database to the correct version of the
Calendar Control.
 

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