We help IT Professionals succeed at work.

Recombine Date after extracting using DatePart Function.

trac
trac asked
on
Hello,

This is my situation.

Using a query I have extracted the three parts of the date field from a table into its'  numeric form.

The date was orignaly in the SHORT DATE  FORMAT  :  dd/mmm/yy  (28/Feb/01)
And was extracted using the following DatePart Expressions:

DatePart("yyyy",[tblMeetings].[Date])
DatePart("m",[tblMeetings].[Date])
DatePart("d",[tblMeetings].[Date])


To Produce VALUES :    28     02       2001
In query Fields Expr1, Expr2, Expr3

I need to recombine the date to insert into a report and while the day and year are ok  as nubmers. I need to convert the Month back into its 3 letter form.

How can I do this.

If anyone can help me, that would be great.

Thanks

trac
Comment
Watch Question

President
Commented:
vDate=format(expr2 & "/" & expr1 & "/" & expr3) will return a date in mmddyy format.  The you can format the resulting date as format(vDate,"mmm") to produce the 3 character month.
How about adding the whole date as another field into the query and use that?

dill
hi trac

on the report in the control source property of the date field write this and it will give the output u are looking for.

=Format(DatePart("d",[tblMeetings].[Date]),"00") & " " & Format(DatePart("m",[tblMeetings].[Date]),"00") & " " & Format(DatePart("yyyy",[tblMeetings].[Date]),"00")

Hope this will solve your problem

rajni

Author

Commented:
rscaiefe

That is exacty the answer I needed. It worked great!  Thank you very much!

Have a good night.

trac

Explore More ContentExplore courses, solutions, and other research materials related to this topic.