UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Trouble With Time In Date Picker, Access 2016    
 
   
wornout
post Jul 5 2017, 04:21 PM
Post#1



Posts: 972
Joined: 17-November 13
From: Orewa New Zealand


I have a strange problem
In my table called time I have 2 fields set to date time formatted to med time
but when I click on the calendar it puts the right date but always puts 12 am as the time not the current time
my laptop is set to the right time and time zone and language etc .
the strange thing is I pulled up an old copy of the db but still 2016 windows 10 that was working and now its doing the same thing
any ideas
Go to the top of the page
 
doctor9
post Jul 5 2017, 04:35 PM
Post#2


UtterAccess Editor
Posts: 17,924
Joined: 29-March 05
From: Wisconsin


wornout,

> when I click on the calendar it puts the right date but always puts 12 am as the time not the current time

The built-in date picker doesn't have a time component. But... if you want to store the "current time" why are you using a calendar date picker for data entry at all? You can just use a command button on the form which could insert the Now() value into the field.

Hope this helps,

Dennis

--------------------
(;,;) Li'l Cthulu says: Please talk about what you're trying to do, as well as how you're doing it.
Changing your real table name to "Table1" and your real form name to "Form1" in your posts makes it more difficult to understand what's going on, not easier.
Guidelines for Posting Questions
Go to the top of the page
 
wornout
post Jul 5 2017, 04:57 PM
Post#3



Posts: 972
Joined: 17-November 13
From: Orewa New Zealand


I always thought that because the datepicker had time and it inserts the current date it would inset the current time thats why I formatted it to med time.
that's a shame it doesn't
Go to the top of the page
 
theDBguy
post Jul 5 2017, 05:10 PM
Post#4


Access Wiki and Forums Moderator
Posts: 71,233
Joined: 19-June 07
From: SunnySandyEggo


There are several date and time picker alternatives in the Code Archive.

Just a thought...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
wornout
post Jul 5 2017, 06:26 PM
Post#5



Posts: 972
Joined: 17-November 13
From: Orewa New Zealand


I did look and saw something in VBA to format datepicker on form load but I can not get it to work
I suspect my date picker name is wrong but I dont know how to tell the name of the date picker
me,Datepicker = Now()
Go to the top of the page
 
wornout
post Jul 5 2017, 07:40 PM
Post#6



Posts: 972
Joined: 17-November 13
From: Orewa New Zealand


I am going round in circles LOL
I now have 2 small buttons next to my starttime and finishtime with the code
Starttime = Format(Now(), "HH:NN:SS AM/PM")
Finishtime = Format(Now(), "HH:NN:SS AM/PM")
but 2 things

1 I have a textbox bound and I want to (in VBA) show the hours and minutes worked
2 then for all the entries with the same taskID the total hours
all this is on a split form
Go to the top of the page
 
DanielPineault
post Jul 5 2017, 07:43 PM
Post#7


UtterAccess VIP
Posts: 5,454
Joined: 30-June 11



Forget the built-in date picker and use one of numerous much better alternatives!!!

See: http://www.devhut.net/2017/06/17/great-acc...endar-controls/ -> specifically look at CyberCow's Time Pieces.

--------------------
Daniel Pineault (2010-2017 Microsoft MVP)
Professional Help: http://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: http://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc


All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...
Go to the top of the page
 
wornout
post Jul 5 2017, 08:08 PM
Post#8



Posts: 972
Joined: 17-November 13
From: Orewa New Zealand


I am not useing a date picker I am useing a button with on click to put current time in the starttime and finish box
Go to the top of the page
 
DanielPineault
post Jul 6 2017, 08:17 AM
Post#9


UtterAccess VIP
Posts: 5,454
Joined: 30-June 11



I was suggesting that you could use a time picker instead.



Based on your current methodolofy, simply do

CODE
Starttime = Now()
Finishtime = Now()


The formatting is done on the control's format property, not in code.



As for 1., create an unbound textbox which performs the calculation.

--------------------
Daniel Pineault (2010-2017 Microsoft MVP)
Professional Help: http://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: http://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc


All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...
Go to the top of the page
 
doctor9
post Jul 7 2017, 09:29 AM
Post#10


UtterAccess Editor
Posts: 17,924
Joined: 29-March 05
From: Wisconsin


wornout,

> I always thought that because the datepicker had time and it inserts the current date it would inset the current time thats why I formatted it to med time.

Again, you're using the datepicker for the wrong thing. If you want to select a "random" date, then you use the datepicker, as you're "pick"-ing a "date". If you want to enter the current date and time, you can use a command button that inserts the Now() value, which includes today's date and the current time.

You wouldn't use a screwdriver to drive a nail into wood, after all. smile.gif You just need to use the correct tool for the task.

Dennis

--------------------
(;,;) Li'l Cthulu says: Please talk about what you're trying to do, as well as how you're doing it.
Changing your real table name to "Table1" and your real form name to "Form1" in your posts makes it more difficult to understand what's going on, not easier.
Guidelines for Posting Questions
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    17th December 2017 - 06:27 PM