A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Easy Time Entry on a form?? Help.



 
 
Thread Tools Display Modes
  #11  
Old December 12th, 2006, 05:15 PM posted to microsoft.public.access.forms
Tech Geek 1234
external usenet poster
 
Posts: 13
Default Easy Time Entry on a form?? Help.

I'm back. The "date and time picker" form itself is good, but I can't figure
out how to use it to get the date and time back to the original field/form.
Here's what I have: a form and subforms with many different date/time fields.
Each of those fields are of date/time type and store both the date and time
in the same field.

The need is simple - I don't want anything fancy, but I have a lot of
date/time fields and it would help my users to be able to use a GUI to enter
the date and time rather than enter it in manually a specific way.

I want to:
1) doubleclick any of the date fields,
2) have it open the calendar to the date within the field or to today's date
if null,
3) the user selects the date and time in the form and clicks the Select
button to close,
4) have the selected date and time appear in the original field and
eventually saved to the record.

It seems like I need to use an external function/module, but I just can't
figure out how to pass the values and get the selected date/time back into
the correct field. As it is, we probably have to concatenate the two fields
from the calendar together to get the date and time in one field.

Can anyone help? There are so many different calendars and instructions out
there and it's hard to pull just what I need from all of them. I don't use
VB regularly enough to remember the syntax to open forms and pass values
correctly.

Thank you!



"Van T. Dinh" wrote:

zipped file is on its way.

--
HTH
Van T. Dinh
MVP (Access)



"Tech Geek 1234" wrote in message
...
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!




  #12  
Old December 13th, 2006, 03:18 PM posted to microsoft.public.access.forms
Van T. Dinh
external usenet poster
 
Posts: 1,048
Default Easy Time Entry on a form?? Help.

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 ...
--
HTH
Van T. Dinh
MVP (Access)



"Tech Geek 1234" wrote in message
news
I'm back. The "date and time picker" form itself is good, but I can't
figure
out how to use it to get the date and time back to the original
field/form.
Here's what I have: a form and subforms with many different date/time
fields.
Each of those fields are of date/time type and store both the date and
time
in the same field.

The need is simple - I don't want anything fancy, but I have a lot of
date/time fields and it would help my users to be able to use a GUI to
enter
the date and time rather than enter it in manually a specific way.

I want to:
1) doubleclick any of the date fields,
2) have it open the calendar to the date within the field or to today's
date
if null,
3) the user selects the date and time in the form and clicks the Select
button to close,
4) have the selected date and time appear in the original field and
eventually saved to the record.

It seems like I need to use an external function/module, but I just can't
figure out how to pass the values and get the selected date/time back into
the correct field. As it is, we probably have to concatenate the two
fields
from the calendar together to get the date and time in one field.

Can anyone help? There are so many different calendars and instructions
out
there and it's hard to pull just what I need from all of them. I don't
use
VB regularly enough to remember the syntax to open forms and pass values
correctly.

Thank you!



  #13  
Old December 13th, 2006, 04:57 PM posted to microsoft.public.access.forms
Tech Geek 1234
external usenet poster
 
Posts: 13
Default Easy Time Entry on a form?? Help.

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?

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?

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.

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.)

Code Replacements
-- My form name is "frmCalendar" and replaces your "gDTPickerForm".
-- My date field is called "txtTrainingRel" and replaces your "txtDateFrom".
-- I intend to use the DblClick event to initiate the calendar, but for now
I have created a command button to keep it as similar to yours as possible.
My button is "cmdGetDate" to replace your "cmdFromDateCal".

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

' Back from the acDialog Calendar
If (CurrentProject.AllForms(frmCalendar).IsLoaded = True) Then
.txtTrainingRel = Forms(frmCalendar).acxCalendar + _
Forms(frmCalendar).acxTimePicker
DoCmd.Close acForm, frmCalendar, 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

Thank you for your help!

"Van T. Dinh" wrote:

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 ...
--
HTH
Van T. Dinh
MVP (Access)



"Tech Geek 1234" wrote in message
news
I'm back. The "date and time picker" form itself is good, but I can't
figure
out how to use it to get the date and time back to the original
field/form.
Here's what I have: a form and subforms with many different date/time
fields.
Each of those fields are of date/time type and store both the date and
time
in the same field.

The need is simple - I don't want anything fancy, but I have a lot of
date/time fields and it would help my users to be able to use a GUI to
enter
the date and time rather than enter it in manually a specific way.

I want to:
1) doubleclick any of the date fields,
2) have it open the calendar to the date within the field or to today's
date
if null,
3) the user selects the date and time in the form and clicks the Select
button to close,
4) have the selected date and time appear in the original field and
eventually saved to the record.

It seems like I need to use an external function/module, but I just can't
figure out how to pass the values and get the selected date/time back into
the correct field. As it is, we probably have to concatenate the two
fields
from the calendar together to get the date and time in one field.

Can anyone help? There are so many different calendars and instructions
out
there and it's hard to pull just what I need from all of them. I don't
use
VB regularly enough to remember the syntax to open forms and pass values
correctly.

Thank you!




  #14  
Old December 13th, 2006, 11:48 PM posted to microsoft.public.access.forms
Van T. Dinh
external usenet poster
 
Posts: 1,048
Default Easy Time Entry on a form?? Help.

See comments in line.

--
HTH
Van T. Dinh
MVP (Access)



"Tech Geek 1234" wrote in message
...
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.




Code Replacements
-- My form name is "frmCalendar" and replaces your "gDTPickerForm".
-- My date field is called "txtTrainingRel" and replaces your
"txtDateFrom".
-- I intend to use the DblClick event to initiate the calendar, but for
now
I have created a command button to keep it as similar to yours as
possible.
My button is "cmdGetDate" to replace your "cmdFromDateCal".

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

' Back from the acDialog Calendar
If (CurrentProject.AllForms(frmCalendar).IsLoaded = True) Then
.txtTrainingRel = Forms(frmCalendar).acxCalendar + _
Forms(frmCalendar).acxTimePicker
DoCmd.Close acForm, frmCalendar, 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

Thank you for your help!



  #15  
Old December 14th, 2006, 03:38 PM posted to microsoft.public.access.forms
Tech Geek 1234
external usenet poster
 
Posts: 13
Default Easy Time Entry on a form?? Help.

Thanks for your comments. I'll work with the form name, maybe try that
global constant idea. Hopefully that will solve the error. As for changing
the reference to the control, I'm not sure exactly what that means. I just
know that the form works when I open it by itself, I just need to obtain the
selected date/time from it.

Thanks for all your help. I'll give it another stab and see if I can get it
working. Otherwise, they'll just have to type in the date!

"Van T. Dinh" wrote:

See comments in line.

--
HTH
Van T. Dinh
MVP (Access)



"Tech Geek 1234" wrote in message
...
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.




Code Replacements
-- My form name is "frmCalendar" and replaces your "gDTPickerForm".
-- My date field is called "txtTrainingRel" and replaces your
"txtDateFrom".
-- I intend to use the DblClick event to initiate the calendar, but for
now
I have created a command button to keep it as similar to yours as
possible.
My button is "cmdGetDate" to replace your "cmdFromDateCal".

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

' Back from the acDialog Calendar
If (CurrentProject.AllForms(frmCalendar).IsLoaded = True) Then
.txtTrainingRel = Forms(frmCalendar).acxCalendar + _
Forms(frmCalendar).acxTimePicker
DoCmd.Close acForm, frmCalendar, 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

Thank you for your help!




  #16  
Old December 14th, 2006, 05:52 PM posted to microsoft.public.access.forms
Lucky1R
external usenet poster
 
Posts: 1
Default Easy Time Entry on a form?? Help.

I am having the same problems with my time picker could you send me the same
zip files Van at . Thanks Van T. Dinh.

"Van T. Dinh" wrote:

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.

--
HTH
Van T. Dinh
MVP (Access)



"Jeff C" wrote in message
...
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
--
Jeff C
Live Well .. Be Happy In All You Do


"Simon Glencross" wrote:

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



"Jeff C" wrote in message
oups.com...
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







 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:27 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.