Simon wrote:Hi Tom,
First glance:
You haven't defined "tfile" as a local variable, it gets lost after preOpenCard.
While not really a problem, in the on mouseUp you don't have to put the field into a variable first, just;
put fld "Aname" into line 1 of tfile
Simon
Edit; I see Klaus beat me to it

Simon & Klaus
It all seems to work except when I close the app and then reopen it The fields contain the data that was in them when the app was compiled.
I can change it and work with it but next time I use the app I need to reenter all the data. This tells me that the data is not being saved.
Here is all of the code I am now using:
Global tfile
on preOpenCard
--check to make sure your folder exists
if there is not a directory (specialFolderPath("documents") & "/sellnet") then
create folder (specialFolderPath("documents" & "/sellnet"))
else
end if
set the defaultFolder to (specialFolderPath("documents") & "/sellnet")
--load your Preference file into memory
put url("file:tAgent.txt") into tfile
end preOpenCard
on openCard
-- this loads the saved data into the fields on card 5 which are used later
-- it is done when the app begins or when the user send the program here to edit the data
put line 1 of tfile into fld "Aname" of card 5
put line 2 of tfile into fld "Aoffice"of card 5
put line 3 of tfile into fld "Acell"of card 5
put line 4 of tfile into fld "officep"of card 5
put line 5 of tfile into fld "Aemail"of card 5
-- Fld begin is = "T" on app startup
if fld "begin" of card 1 ="T"
then
put "F" into fld "begin" of card 1
go card 1
end if
--if the user directed the program here then stay on the card to edit data and save with the finish button
end openCard
The finish Button code:
global tfile
on mouseUp
--specify a path
set the defaultFolder to (specialFolderPath("documents") & "/sellnet/")
put fld "Aname" & cr & fld "Aoffice" & cr & fld "acell" & cr & fld"Officep" & cr & fld"Aemail" & cr into tfile
--save the updated file to disk
put tfile into url("file:" & (specialFolderPath("documents") & "/sellnet/tagent.txt"))
end mouseUp
I can't seem to get it.
What appears to be happening is that the data loaded in the openCard handler is not from a saved file.If the fields are edited then the data loaded anytime while the app is running is correct.
When the app is exited then everything reverts to the original data.
Thanks for your help.
Tom