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
557 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Handle Apostrophes in SQL Parameter 16 67
SQL: splitting Columns 6 39
office 2016 license quastion 3 43
Speed up Select Top n... Query 9 36
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

734 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