Passing date field to Word Document

PaulJK

Registered User.
Local time
Today, 07:07
Joined
Jul 4, 2002
Messages
60
Hi,

I have a control on a form which opens up Word and completes fields in the Word document with data on the form. It basically fills in an invoice form.

Everything works ok apart from when the invoice date and order date fields are passed. In the tables and in the forms, the dates are in Long Format ie '17 May 2005'. However, when they are apssed to the Word document, they are in a shortened format ie '17/05/05'. I am required to show the Long Format but am at a loss to find out how to achieve this.

I use bookmarks in the Word document and the code on my form relating to these fields are:

.ActiveDocument.Bookmarks("OrdDate").Select
.Selection.Text = (CStr(Forms!frmOrders!OrdDate))
.ActiveDocument.Bookmarks("OrdDateInv").Select
.Selection.Text = (CStr(Forms!frmOrders!OrdDateInv)


The Word document cannot be changed as far as I can see. I believe the answer could be to change the code above to change the format, but cannot get anything to work?

Your assistance would be helpful.

Thanks
 
You need to format the date. Converting it to a string will assume the default date format.

(Format(Forms!frmOrders!OrdDate,"Long Date"))

If you want to use a custom format rather than one of the standard date formats, just replace "Long Date" with the format you want.
 

Users who are viewing this thread

Back
Top Bottom