I made an assumption that you were using a print script to print your letter and the one line of code given abovewould have been added to your existing print script.
I don't think I have enough information on your solution to know exactly what to recommend, but I'll give it a try.
If I was building the solution, navigation to the letter would never be required. The form view should suffice for any required input. Taking the user to the actual print out and having them edit anything on the print out wouldn't be cool in my book.
So some place I would have a button to print my letter. Attached to that button would be a script. The script would look something like this:
User Abort Off
Error Capture On
Enter Browse Mode
SET FIELD(Print Date,DateToText(Date( Month(Today) , Day(Today) , Year(Today) ))
Go TO Layout[Letter}
Enter Preview Mode
Print[no dialog]
Enter Browse Mode
Go To Layout[form page]
If you are new to scripts, I want to point out that you always go to preview mode, then print for a letter or report. If you are starting this script with a button placed on your form page, FM will go the print letter layout, switch to preview mode, print the document, switch back to browse mode and back to your form page without the user being aware that anything happened except the letter printed. In other words, the screen stays on the form page the whole time. It doesn't have to be this way, but know that it's an option you have. If for example you would like to show the user the letter, you can place another line of code in the print script like this:
Show Dialog[Would you like to print this letter?, Yes, No]
If(Status[Current Message] = "Yes"
Print[no dialog]
end if
Based on your comments, it also sounds like you may be lost on how to create a SET FIELD in the script. So here is a little more detail if you need it. Here is an easier formula.
Select Scripts, then Scriptmaker
Create a new script or choose an existing script,
select edit,
on the left hand function list, scroll down and select
SET FIELD [] option listed on the bottom part of your screen is field and specify. Press field and select the field you wish to contain your static date.
Next click on specify. A calculation window opens up and you need to fill in the date calculation here.
From the top right of the dialog box, select view, from the drop down menu, date functions. Now all of the date functions are listed.
First select DateToText ( date ). Where the word 'date' is, this is a prompt from FM telling you where to put your next function.
So highlight the word date with your mouse, go back up to the date function list again and select:
Today
Your date function is complete and should look like this:
DateToText ( Today ). A little simpler than above.
Since we are learning FM here, the formula above works exactly the same except you can have the flexiblilty to add 14 days to your date function. It would look like this:
SET FIELD(Print Date,DateToText(Date( Month(Today) , Day(Today)+14 , Year(Today) )).
Add one month to todays date like this:
SET FIELD(Print Date,DateToText(Date( Month(Today)+1 , Day(Today) , Year(Today) ))
What we did different here is where the word 'date' was, we put together several function to add together the date. Playing with this will help you better learn all of the functions and how to manipulate them.
One more point of clarification. You mentioned post the date to the form as well. Understand that you can have the field date on as many forms and screens as you would like. When you use the set field option, the value is set into the field and will show up everywhere the field is placed. You do not have to go to every layout and paste or set field on every screen.
If this is what you were thinking, this may have come from any use of copy and paste functions. To copy a value from a field, the field has to be on the current layout. Then to paste that value to another field, you have to go to a layout where the field is accessible to be able to paste it.
Set field I like be cause the field can be formated to not allow entry by the user. This is a good option for your date problem. Allowing the user to tab into or place their cursor into the field allows them to edit the mail date. Having a script do the set field updates the field even though it is set to not allow the user access. This keeps the integity of the date field in tact.
I hope this novel helps you.
Marty