Time picker (1 Viewer)

Micron

AWF VIP
Joined
Oct 20, 2018
Messages
1,795
You don't want this for always picking the current time do you? Or just deviating slightly from the current time? There are/were ActiveX controls for older versions but I would not advise the use of such controls.
 

Dick7Access

Dick S
Joined
Jun 9, 2009
Messages
3,523
You don't want this for always picking the current time do you? Or just deviating slightly from the current time? There are/were ActiveX controls for older versions but I would not advise the use of such controls.
Actually, it's for my wife's medical activities. She liked the one I built for myself for my VA doctors, so I tweaked it a bit to fit her needs. The date goes in as default, as does the time. However, she and I both can not always put our activities in at the moment it happens. I can go in and change the time later than night, but she can’t. She is in a nursing home and probable first stages of Alzheimer’s.

BTW: That's what I found when I googled it. Nothing reliable.
 

Micron

AWF VIP
Joined
Oct 20, 2018
Messages
1,795
Not sure if your answer puts me on the right track, but if you have a date/time field on a form, you could represent the time as (I presume) as 00:00 AM as a normal textbox, or as large as a digital clock, and use a spinner control on either side of those digits to increase or decrease the numbers. Shouldn't be too hard to create.
 

Dick7Access

Dick S
Joined
Jun 9, 2009
Messages
3,523
Thanks so very much for answering. Sounds interesting, but a bit over my expertise (Digital clock in Access, Spinner Control), but very interesting. do you have a link, I would love to study it? I will also google it.
 

Micron

AWF VIP
Joined
Oct 20, 2018
Messages
1,795
Oddly enough, I was searching for one that I was playing with several months ago. I seem to recall that I deleted it, thinking I would never need it and can't find it now. However, it was a bit more complicated I think, as it advanced every second (it was keeping real time and looked like a digital clock) and I don't think that's what you want. If you provide a bit more information I could probably throw something together for you. If that info would be too personal to post here, you can send me a PM if you care to.
 

Micron

AWF VIP
Joined
Oct 20, 2018
Messages
1,795
I threw something together in an hour and 15 minutes. Could have been quicker but clicking on unbound textboxes did some wonky things with the time formats as the textboxes gained/lost focus. Had to find the right combination, syntax and format properties for what I was after.

It's nothing fancy and I might have been able to condense the code, but one never knows how far to go with something like this. It could turn out to be totally useless for you. Anyway, although I'm not a big fan of ActiveX controls in an enterprise situation, I don't suppose it would be any huge deal if down the road this control didn't work in some later version. So here it is
View attachment ClockSpin.accdb
 

Dick7Access

Dick S
Joined
Jun 9, 2009
Messages
3,523
Oddly enough, I was searching for one that I was playing with several months ago. I seem to recall that I deleted it, thinking I would never need it and can't find it now. However, it was a bit more complicated I think, as it advanced every second (it was keeping real time and looked like a digital clock) and I don't think that's what you want. If you provide a bit more information I could probably throw something together for you. If that info would be too personal to post here, you can send me a PM if you care to.
AWF guys are super, thanks for answering, oops sorry and gals.
Nothing personal. All she needs is some an easy way to change the time. I on the other had love learning more Access.
 

Attachments

MajP

I wish I could go back in time... I'd take state
Joined
May 21, 2018
Messages
2,459
How do I get the chosen value into the DB?
Do you want a Popup control or build it on your form? I think Micron was suggesting to build this directly on your form. But you could make a popup.
 

MajP

I wish I could go back in time... I'd take state
Joined
May 21, 2018
Messages
2,459
Using Micron's form and a little extra code. Here is a reusable pop up.

You will need a version of this every time you call it
Code:
Private Sub cmdTime_Click()
  Dim theTime As String
  If IsDate(Me.enterDate) Then
    theTime = Format(Me.enterTime, "hh:mm")
  Else
    theTime = Format(Now, "hh:MM")
  End If
  DoCmd.OpenForm "TimeControl", , , , , acDialog, theTime
  If CurrentProject.AllForms("TimeControl").IsLoaded Then
   Me.enterTime = Forms("timeControl").txtTime
   DoCmd.Close acForm, "TimeControl"
  End If
End Sub
I have built a lot of time controls, but they have always got complicated. Micron's control with hour and minute spinners make it simple and fast.
 

Attachments

Micron

AWF VIP
Joined
Oct 20, 2018
Messages
1,795
How do I get the chosen value into the DB?
Bind the control to a field in a record source. Your form is bound to an editable query, so I think all you'd have to do is change the code references to 'enterTime' because that's the name of your table field.
 

Dick7Access

Dick S
Joined
Jun 9, 2009
Messages
3,523
Bind the control to a field in a record source. Your form is bound to an editable query, so I think all you'd have to do is change the code references to 'enterTime' because that's the name of your table field.
I will give it a try
 

Dick7Access

Dick S
Joined
Jun 9, 2009
Messages
3,523
If you get stuck, I will try to apply my code to your db and post back. Will have to wait until tomorrow (after midnight here and I just got in).
Thanks for the offer. I might take you up on that, but first I want to try it myself. A little bit of tears and cusing is the best teacher.
However, I will not be working on anything on Access for a while.
I leave for Guadalajara, Mexico tomorrow morning.
See you all in a couple of weeks.
In Dec. maybe I can bug doc_man about it, but then he is pretty good at eating also.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom