Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

DTPicker date stored as variable

Posted on 2000-05-04
6
Medium Priority
?
580 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
Technology Partners: 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 200 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

885 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