Solved

I'm trying to figure out how to update an access 2007 field on a from using a date and time picker similiar to the calendar picker in access

Posted on 2011-09-23
11
551 Views
Last Modified: 2012-05-12
I'm trying to figure out how to update an access 2007 field on a from using a date and time picker similiar to the calendar picker in access. I want to write the date and time to the field.
Time-Picker.docx
0
Comment
Question by:shieldsco
  • 5
  • 3
  • 3
11 Comments
 
LVL 12

Expert Comment

by:danishani
ID: 36590864
You can use the Date and Time Picker ActiveX control for this, set the Format on 2 dtp-Time.

See attached picture.
use TimePicker
Hope this helps,
Daniel
0
 
LVL 84
ID: 36591953
Was there some reason you closed out your identical question here: http://www.experts-exchange.com/Database/Miscellaneous/Q_27322292.html. Just curious, as the comment from Peter was a link to a very nice Date and Time picker that is built using native Access objects.

The use of ActiveX controls in Access is spotty, at best. The control suggested here was never intended to be used in Access, and while it works in many Access installations, it is not guaranteed to run in all of them.  I have had troubles with that specific control (the DTPicker control) in Access 2003 and 2007, but only on certain machines.

Note also that Access 2007/2010 has a builtin DatePicker, but it doesn't have anything for Time.



0
 

Author Comment

by:shieldsco
ID: 36592260
how can I use the dtpicker similiar to the calendar to update a table using a form
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

Author Comment

by:shieldsco
ID: 36595052
how can I update an access table from a form using the dtpicker suggested by Peter - I received no response from him
0
 
LVL 12

Expert Comment

by:danishani
ID: 36597140
Well as I agree with DatabaseMX that using ActiveX Objects can be tricky, it would work as long as References are set propperly, but you might go for the safer solution as Peter suggested.

To get this TimePicker (UA solution by Mark) to work, check the frmDemo. In the DoubleClick Event of the txtTime you will see the code behind this. To get it to work for you simply use this:

    DoCmd.OpenForm "frmMiniTimePicker", , , , , acDialog
    ' move the focus off the date control
    Me.txtFocus1.SetFocus

Hope this helps,
Daniel
0
 
LVL 84
ID: 36598438
No biggie, but I'm not DatabaseMX :)

And this statement:

"it would work as long as References are set propperly"

Is most certainly not true in Access. While it may work properly on YOUR machine, there is a very good chance it will NOT work properly on other machines, even if the ref is properly set. I've seen it happen far, far too many times and cause far too much grief.

The Access environment is quite different from other COM-compliant environments, and ActiveX controls are (generally) not built to be compliant with the Access environment (has to do with the way the control exposes its interfaces and such). Even those from Microsoft are NOT compliant with the Access environment (unless they are specifically designed to do so, and the one being suggested is NOT).

That's not to say it won't work, but that instead you really, really should look at native Access methods before resorting to ActiveX controls. And, if you really, really need ActiveX controls, then move up to VB6 - or even better, make the big dive into .NET!
0
 

Author Comment

by:shieldsco
ID: 36598649
I get a compile error when I try to run the following code: DoCmd.OpenForm "frmMiniTimePicker", , , , , acDialog
    ' move the focus off the date control
    Me.txtFocus1.SetFocus

See attached screen shot

Doc1.docx
0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 36598679
The error means you don't have a control named "txtFocus1" on the current document. The "Me" preface refers to whatever object your code is running in - for example, if you run this from a form named "frmCustomer", then that code would (a) open the form named frmMiniTimePicker in Dialog (i.e. Modal) mode and then (b) attempt to set the focus to a control named txtFocus1 on frmCustomer. If you're expecting something different, please indicate what you're trying to achieve.

0
 
LVL 12

Expert Comment

by:danishani
ID: 36599046
@ LSMConsulting:

Sorry for mixing you up with DatabaseMX, I don't know where that came from hehe. My apoligize for that. Point taken, thanks for the explanation. I know its not the best practise using ActiveX controls, but had no bad experience so far. I guess better avoiding it then getting in trouble later.

@ shieldsco:
Yes, change the field txtFocus1 to an existing field on your Form, or simply remove it, if you have no use for it.

0
 

Author Comment

by:shieldsco
ID: 36599059
Thanks - it seems to work fine - the data is written to my table. Nice job
0
 

Author Closing Comment

by:shieldsco
ID: 36599089
Good job
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question