mp_direct
11-05-2005, 01:08 PM
Hi All,
My program is a questionnair where the user simply enters data like Title, Firstname, Surname etc. Once the user clicks on SAVE it outputs the data to a txt file.
The way it should work is each time a user clicks on SAVE, if the file "C:\Test1.txt" already exists, the file name is changed by inserting the SYS data/time, and a new text file is created "Test1.txt", which has all the previous data plus the new data just inputted by the user i.e. the most up-to-date version file.
The problem i am having is if the file exists and after it has renamed the file with SYS DATE/TIME, when creating the new "Test1.txt" file will ALL THE PREVIOUS data is lost and it simply displays the new data the user had just inputted. :confused:
If retval = fileName Then
MsgBox "file already exists", vbCritical
Name "c:\Test1.txt" As "c:\Test1_OLD_" & Format(Now, "yyyy-mm-dd HhNn") & ".txt"
End If
Open "C:\Test1.txt" For Append As #1
Write #1, txtTitle, txtFirstname, txtSurname
Close #1
Any comments would be appreciated.
My program is a questionnair where the user simply enters data like Title, Firstname, Surname etc. Once the user clicks on SAVE it outputs the data to a txt file.
The way it should work is each time a user clicks on SAVE, if the file "C:\Test1.txt" already exists, the file name is changed by inserting the SYS data/time, and a new text file is created "Test1.txt", which has all the previous data plus the new data just inputted by the user i.e. the most up-to-date version file.
The problem i am having is if the file exists and after it has renamed the file with SYS DATE/TIME, when creating the new "Test1.txt" file will ALL THE PREVIOUS data is lost and it simply displays the new data the user had just inputted. :confused:
If retval = fileName Then
MsgBox "file already exists", vbCritical
Name "c:\Test1.txt" As "c:\Test1_OLD_" & Format(Now, "yyyy-mm-dd HhNn") & ".txt"
End If
Open "C:\Test1.txt" For Append As #1
Write #1, txtTitle, txtFirstname, txtSurname
Close #1
Any comments would be appreciated.