Results 1 to 15 of 15
  1. #1
    Join Date
    May 2006
    Posts
    30

    Unanswered: Microsoft Date & Time Picker Control

    I am using Access 2003 SP3. When I put a Microsoft Date and Time Picker Control 6.0 (SP4) into a form, I find that the "On Updated" event doesn't work, i.e., it doesn't trigger its subroutine. The other events all work, but as Murphy's Law would have it, the On Updated is the one I need.

    I tried this on 2 different databases on 2 different computers with the same result.

    I don't expect even an Access Guru to be able to fix this control, but do you think Microsoft might consider fixing it? If so, how does one let them know about the problem in a way that has a chance of getting to the right person? I know there are other date pickers out there, but this one is the best one I have seen for simplicity and appearance.

    Part 2 of this question is, how does one get more information on the ActiveX Controls furnished with Access 2003? I have done a Google search, but had no luck. The date picker in question is fairly straightforward and easy to use, but some of the other controls are more complex. There may be a control there that is ideal for my application, but I have no clue what its name is or how to use it.

    Thanks,

    Charles

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    are you certain its a problem with the control?

    ...check the access form designer / runtime knows there is code behind the event
    if you select the control on the form in design mode,
    right click
    examine the properties
    select the events tab
    see if "on updated" event says something similar to [event procedure], if not thats your problem, you have some code which the Access runtime isn't aware of

  3. #3
    Join Date
    May 2006
    Posts
    30
    Healdem,

    For each listed event in the properties there is the entry [Event Procedure].

    Using the automatically generated code template for each event I have the following procedures:

    Private Sub DTPicker2_Enter()
    Response = MsgBox("Date Time Picker Enter", vbOKOnly)
    End Sub

    Private Sub DTPicker2_Exit(Cancel As Integer)
    Response = MsgBox("Date Time Picker Exit", vbOKOnly)
    End Sub

    Private Sub DTPicker2_GotFocus()
    Response = MsgBox("Date Time Picker Got Focus", vbOKOnly)
    End Sub

    Private Sub DTPicker2_LostFocus()
    Response = MsgBox("Date Time Picker Lost Focus", vbOKOnly)
    End Sub

    Private Sub DTPicker2_Updated(Code As Integer)
    Response = MsgBox("Date Time Picker Updated", vbOKOnly)
    End Sub

    All of these produce the expected message except Sub DTPicker2_Updated which produces no message. Also as expected given that result, putting a breakpoint in Sub DTPicker2_Updated produces no break in code execution.

    Charles

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    ok try a compare and repair, and see if Access has got its knickers in a twist and there is a compile problem which is triggering difficulties

    failing that are you certain Access supports the controls the updated event, bear in mind the control is a generic control available to windows developers, not every interface supports every method and property

    Ive never used this control so I don't know. Have you used this control elsewhere and had the updated event fire?

    Alternatively, what are you trying to do, it may be that there are others ways of achieving what you want. Quite often the in the systems worlds you have to do things another way, very frequently in Access you have to do things th Access way or not at all.

  5. #5
    Join Date
    May 2006
    Posts
    30

    Date Picker Problem

    Healdem,

    I have tried compact & repair with no change in results. You may be right about the one event not being supported in Access. However, it seems strange to me that of the group of events that are available, Microsoft would pick "On Updated" as the one not to support.

    No, I have never used this control before this.

    I have thought about other ways to do what I want, but have not yet come up with a satisfactory solution.

    The user has a choice of using the current date (Now) or the date the document/media was received to generate the document ID. The document ID code uses the date, document/media type and a unique number to generate the ID. If the user has set the choice to "Use received date" and has not entered a received date, he/she is prompted to enter the date. Normally, entering the document/media type would have triggered the generation of the ID. In this case, the document/media type has been entered and the received date is required. My plan was to have the received date "on updated" event trigger the generation of the ID. None of the other events will do the job properly. The way it is now, after entering the date the user would have to go back and re-choose the document/media type to trigger the ID generation. I am not satisfied with having the user do this.

    I may just use one of the date pickers furnished by developers even though, for various reasons, I don't like them as well for this application.

    Thanks very much for your continued help! I do appreciate it.

    Charles

  6. #6
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    ...ok so if all you want is the date a user has selected, then I'd suggest you use the "on click" event.
    or failing that read the value of the control immediately prior to updating anything.
    I doubt the updated event is the right event for what you want to do.

  7. #7
    Join Date
    May 2006
    Posts
    30

    Date Picker Problem

    Sorry Healdem,

    There is no "On Click" event. The subprograms I listed on a previous post cover all of the events listed in the Date Picker properties. The way the control is used is that you click on it and it shows a mini-calender with the current date circled. You can pick a date from the current month by clicking on it or you can roll the calendar back or forward to click on another year/month/day. You can see why an On Click event would not be too useful. I assume that if the On Updated event worked it would trigger when one actually selected a date.

    Thanks again,

    Charles

  8. #8
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    thats not how the updated event usually works, usually its triggered immediately befoire an update of the record takes place or immediately after

    I suspect you may be better off to place some code in the forms (rather than the controls) before update event, which triggers immediately before a record is updated.

    As an alternative you could examine the result of the the control in its on lost focus event and assign a value as required.

    You many need to play around with the events to find which events are appropriate for your use.

    HTH

  9. #9
    Join Date
    May 2006
    Posts
    30

    Date Picker Control

    Healdem,

    Thank you very much for your help. I will give some more thought to a solution and will eventually come up with something. I thank you for your time and for sharing your expertise with me.

    I have said it before, this is a great forum. It is people like you who make it great.

    Thanks,

    Charles

  10. #10
    Join Date
    Apr 2004
    Location
    Kingsland, Georgia
    Posts
    231
    this may be worth nothing, as i use the Microsoft Date and Time Picker 6.0, but that control has a Change event. That event fires when the user selects a date. could that be what you're looking for? That's not one of the options through the properties window in Access, but if you go into your code window and select your control from the control combobox, it will give you a list of all the different events for your control in the one to the right.

  11. #11
    Join Date
    May 2006
    Posts
    30

    Date Picker

    Thanks for the suggestion. I tried it, but I got the same events that I got the other way. So, unless I did something wrong, my date picker, or something else, is different from yours. For your information, I also tried the other 2 Active X calendars, thinking I could use one of them to make my own date picker. The "On Update" event did not work for either one of them. As a sanity check I tested the other events and they do work. At least Microsoft is consistent.

    I have spent way too much time on this, so I will have to find some other solution to my problem.

    Thanks,

    Charles

  12. #12
    Join Date
    Apr 2004
    Location
    Kingsland, Georgia
    Posts
    231
    May have found what you're looking for, although you probably have gotten past it by now. the CloseUp() method seems to work pretty much the same. it doesn't fire when the user switches months, like the Change() event does, but does fire when they select a date and the picker closes up.

  13. #13
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    You may not see the OnClick (or Click) event in the properties for the Date/Time Picker control but I think if you actually code it in vba, you can utilize the Click vba code ... something like: Private Sub ActiveXCtl0_Click() or Private Sub MyCalControl_Click(). I never really understood though why Access didn't put it in with the other events in the properties box. There's an example in the code bank showing this with the Date/Time Picker control.
    Last edited by pkstormy; 02-28-08 at 22:54.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  14. #14
    Join Date
    May 2006
    Posts
    30
    The On_Click event does work, but not in the way I needed it to. It responds to a click in the control text box; I needed a response to a click on the calendar date.

    I say "needed" because I have found an excellent date/time picker on the Access to Go website. It can respond to a click or can be called from a procedure. The call from procedure method fits my requirement very well. Their date/time picker costs only 15$ and is well worth it to me.

    Thanks to all who replied,

    Charles

  15. #15
    Join Date
    Sep 2008
    Posts
    1
    You should have tried OnChange, Access VBA accepts this event also. Thanks for the tip pkstormy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •