Solved

DTPicker date stored as variable

Posted on 2000-05-04
6
372 Views
Last Modified: 2010-05-02
I want to store the formatted date as a string variable to use in other places.  I have tried the following code:

Dim Letter_Date As String
Letter_Date = Form1.DTPicker1.Value

But the variable Letter_Date comes back as 05/05/00, but I want it to be May 5, 2000.

The control is displaying the date in the correct format, so my question is how do you store the displayed (formatted) date as a variable?

Thank you,


0
Comment
Question by:mhewes
  • 2
  • 2
  • 2
6 Comments
 
LVL 9

Expert Comment

by:GivenRandy
ID: 2779048
Doubleclick on the DateTimePicker control.

Set the type to:

3 - dtpCustom

In the CustomFormat field, set to:

MMM d, yyyy

Or, if you want two digit days:

MMM dd, yyyy
0
 
LVL 9

Expert Comment

by:GivenRandy
ID: 2779050
I mean, right-click then Properties.
0
 

Author Comment

by:mhewes
ID: 2779066
This has already been done.  I stated in the question that DTPicker is displaying the correct format.  What I want to do is to store the formatted date to a string variable so that I can insert the date into other text.

Thanks,

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Accepted Solution

by:
AnswerTheMan earned 50 total points
ID: 2779072
Dim X As Date
    X = DTPicker1.Value
    MsgBox FormatDateTime(X, vbLongDate)
0
 
LVL 5

Expert Comment

by:AnswerTheMan
ID: 2779075
Dim X As String
X = FormatDateTime(DTPicker1.Value, vbLongDate)
MsgBox X
0
 

Author Comment

by:mhewes
ID: 2779113
Thanks AnswerMan, that was too easy for you!

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question