Date Picker

M

Mark A. Sam

Hello,

Is there a VBA method to bring up a calander without having to click the
DatePicker icon for a date control?

Thank you and God Bless,

Mark A. Sam
 
L

Linq Adams via AccessMonster.com

Not sure of exactly what you have in mind, but here's a routine that I use:.

If you'd like to only have the DatePicker appear when you need to pick a date,
you can use this routine.

YourTextBoxName is the name of the box that will hold the date

YourDatePickerName is the name of your DatePicker.

First, place the DatePicker where you want it to appear on the form.

Next, select the DatePicker and goto Properties--Format and set Visible = No

Then place this code in the form's code module:

Private Sub Form_Load()
YourDatePickerName = Date
End Sub

Private Sub YourTextBoxName_DblClick(Cancel As Integer)
YourDatePickerName.Visible = True
End Sub

Private Sub YourDatePickerName_Click()
YourTextBoxName = YourDatePickerName
YourTextBoxName.SetFocus
YourDatePickerName.Visible = False
End Sub

Now, when your user DoubleClicks on the textbox where the date will go, the
DatePicker will appear. The date is picked, and the DatePicker disappears!

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 
M

Mark A. Sam

Linq,

Are you talking about an ActiveX control named "DatePicker"? I am referring
to the Datepicker that is built into a Textbox linked to a date field in
Access 2007. When the field gets the focus, an icon appears and the
calendar pops up. There is a property for the textbox called,
ShowDatePicker with options, "For Dates" and never. If there was a third
choice, "Always" that would solve my issue. If a user clicks on the
textbox, he has to then click on the icon. I want to bypass that step so
that if he click on the control, the Calendar pops up immediately.

I don't now if that makes sense, but I just want to bring up the calander
with one click rather than two.

God Bless,

Mark
 
L

Linq Adams via AccessMonster.com

Sorry! You really need to ***always*** include the fact that you're running
2007 when posting a thread! The differences between 2007 and all previous
versions are so great!

Don't have a clue since it's 2007. You desire to have only one click to bring
up the calendar is more than reasonable! Since the entire purpose of using a
calendar is to facilitate the easy, accurate entry of dates, common sense
would dictate that if the developer chose to have one pop up, it would do so
when the field was entered! If I use a calendar, it means I don't want my
users to input the date manually! But, of course, we're talking about Micro
$oft!

Maybe someone who's using 2007 has a workaround.

Good Luck!

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 
M

Mark A. Sam

That's what I wanted. Thanks Jeff.


Jeff Conrad said:
Hi Mark,

Just use this code when the control gets focus:

DoCmd.RunCommand acCmdShowDatePicker

--
Jeff Conrad - Access Junkie - MVP Alumni
SDET - XAS Services - Microsoft Corporation

Co-author - Microsoft Office Access 2007 Inside Out
Presenter - Microsoft Access 2007 Essentials
http://www.accessmvp.com/JConrad/accessjunkie.html
Access 2007 Info: http://www.AccessJunkie.com

----------
This posting is provided "AS IS" with no warranties, and confers no
rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.mspx
 
M

Mark A. Sam

Jeff,

I implemted this and on the first trial of the app, the user remarked that
she liked it. Thanks again.

God Bless,

Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top