473,320 Members | 2,083 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Date and Time Picker (How to open it?)

Hi Everyone

I want to use a control called "Microsoft Date and Time Picker Control 6.0 (SP4)" on my form.

So basically I want to double click a text box and transfer the date to the DTPicker control (I have this) then I want to open the DTPicker (using still the double click event) to show the calendar as would normally click it (to open the calendar).

I hope this make sense.

Do you know maybe how to do it? (VBA code) I cannot find the property to open the control to show the calendar (view).

Thanks in advance
Emil
Dec 11 '07 #1
2 7369
missinglinq
3,532 Expert 2GB
Here's a routine I use with a calendar, rather than a DTPicker, but it should do just fine:

What I do for this type of thing is place a calendar control on the form, positioned as you like and set it's Visible Property to NO.

Then, using the DoubleClick property of your text box, have the calendar "popup" for date selection. You'll need to replace YourCalendarName and YourTextBoxName with the actual names of your calendar and text box.

Expand|Select|Wrap|Line Numbers
  1. Private Sub YourCalendarName_Click()
  2.   YourTextBoxName.Value = YourCalendarName.Value  
  3.   YourTextBoxName.SetFocus
  4.   YourCalendarName.Visible = False
  5. End Sub
  6.  
  7. Private Sub YourTextBoxName_DblClick(Cancel As Integer)
  8.   YourCalendarName.Visible = True
  9.   YourCalendarName.Value = Date
  10. End Sub
Now, all your user has to do is DoubleClick on the text box and up pops the calendar! When the user clicks on the date, the calendar disappears and the text box is populated with the date.

Welcome to TheScripts!

Linq ;0)>
Dec 11 '07 #2
Thanks for the welcome :)

The code works with the calendar control (of course) and it is very useful, thanks.

The form I have is with a sub form (the calendar control is too big to fit it anywhere) and what I'm thinking about is after double clicking the date field a new form with the calendar control would appear but I don't know how to transfer the date to the proper record (double clicked field) in the sub form. (as the setfocus will no longer work, at least when I tried :)

Any ideas?

Many thanks
Dec 12 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Adrian Parker | last post by:
Hi. I have a date time picker in my program which uses ADO to read from an Access database. It works perfectly, unless the database is empty (no records) when opened. When you try to open an...
3
by: gregmalenky | last post by:
Visual C# 2005 Express - I am creating a employee scheduling program for work. When I need to do is for the program to open with a start date of the previous sunday. I also want the ability to...
2
by: Need Helps | last post by:
The example given in msdn.com on how to create a Date Time Picker involves using the CreateWindowEx function. However, I created a dialog box using the graphical interface, and then used the...
4
by: Michael Turner | last post by:
Hi Guys I have two DateTime pickers one shows the Date and the other the time, this is a requirement of the solution. The problem I have is that when the time is saved to the sql database into a...
2
by: Darhl Thomason | last post by:
I'm converting my Access 2003 VBA app. I have a number of date fields in my db that I want to use the date/time picker control with, but if there is no entry in my database, I want the date/time...
4
by: Michel Posseth [MCP] | last post by:
I have a problem with the date time picker validate event wich i believe is a bug How to reproduce : throw on a form a date time picker control and a textbox control select the validating...
3
by: luanhoxung | last post by:
hi all ! i have a date & time picker control bound to 1 field. it worked fine. But i always get the message :" Can't set value to Null when checkbox properties = FALSE" when i open my form. there...
0
by: fredloh | last post by:
i have a tab control on my form. i then have several microsoft date and time picker control on the tab control. when i select a date on any of the date and time picker control, the result of the...
1
by: 6afraidbecause789 | last post by:
Hi - I am using a Date/Time Picker popup form for users to choose a a date and time for use on a separate entry form. The date/time on the entry form is actually entered automatically as a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.