A better date picker (1 Viewer)

Status
Not open for further replies.

isladogs

CID VIP
Local time
Today, 21:59
Joined
Jan 14, 2017
Messages
13,753
Some months ago I uploaded a replacement date picker (see DatePicker.accdb attached) that has no Active X controls and can also be used in 64-bit Access.

It was originally posted in response to a question about Stephen Lebans' calendar in this thread

https://www.access-programmers.co.uk/forums/showthread.php?p=1533910#post1533910

Having just spent a long time searching for the thread, I'm posting it here so its easier to find in the future! ;)

The original version by Brendan Kidwell is open source from 2003 and can be found here:
http://www.glump.net/content/accessdatepicker/

However, I've made extensive changes to the appearance of the calendar form



If all you want is a visual calendar, it will certainly do that
However, its main purpose is to input a date in a form textbox
All you need for that is one line of code in the textbox click event:

Code:
Private Sub txtDate_Click()
    InputDateField txtDate, "Select a date to use this on your form"
End Sub
The string "Select a date to use this on your form" is used for info on the form and can be adapted to suit

To use, copy frmDatePicker & modDatePicker to your own database
Ignore frmMain - its only needed for the example db
 

Attachments

Last edited:

Scribtor

Registered User.
Local time
Today, 22:59
Joined
Sep 27, 2018
Messages
16
Million thanks! Should be a sticky so as to be easier to reach :D
 

isladogs

CID VIP
Local time
Today, 21:59
Joined
Jan 14, 2017
Messages
13,753
Glad you like it. If there are too many stickies, none of them stand out.
 

JoeNoEskimo

New member
Local time
Today, 15:59
Joined
Mar 29, 2019
Messages
2
Very nice tool. I have added it to my pet project. I did however make one little addition. At some places in the database I'm working on I want the date picker to return date and time. So I made this change:

' Use this method to prompt for and set a new date on a textbox
Public Sub InputDateField(x As TextBox, AddTime As Boolean, Optional Prompt As String = "Select Date")

mPrompt = Prompt
mInitDate = x.Value

RunDialog

If IsDate(mReturnValue) Then
If AddTime = True Then
x.Value = mReturnValue & " " & Time()
Else
x.Value = mReturnValue
End If
End If

End Sub

Call it:
InputDateField DonationDate, False, "Date Picker"
InputDateField DistributionDateTime, True, "Date Picker"

I hope this little addition helps someone else,
Joe
 

rxm01l

Registered User.
Local time
Today, 13:59
Joined
Mar 5, 2013
Messages
32
I would like to utilize this Calendar on my form contained. Start_Date and End_Date.. How would I code this so that your Calendar popup so that I can select Start_Date from Calendar and End_Date from this Calendar? Please advise.. Thank You..
 

isladogs

CID VIP
Local time
Today, 21:59
Joined
Jan 14, 2017
Messages
13,753
Hi rxm
Just follow the instuctions in post #1, adding the InputDateField code to the click event of both date controls
 

rxm01l

Registered User.
Local time
Today, 13:59
Joined
Mar 5, 2013
Messages
32
Thank You Isladogs, I got it to work right after I posted my question. Great learning tool..

If I want add a Fix Time after selecting Date. Example: 08/07/2019 07:00:00 AM or 08/07/2019 03:00:00 PM, how would I do that by using this Calendar? in my old Calendar I used:
Me.Start_DATE.Value = Me.Calendar.Value +TimeValue ("03:00:00 AM").. doesn't see to work on this calendar... Any recommendation would be appreciated.. Thank You so much..
 

isladogs

CID VIP
Local time
Today, 21:59
Joined
Jan 14, 2017
Messages
13,753
Hi rxm
Posting a question often leads almost immediately to the solution ;)
Regarding times, have you looked at the code suggested by JoeNoEskimo in post #6?
 
Status
Not open for further replies.

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

Top Bottom