I asked about a more basic version of this problem a previous post, but now I need some more in depth information, in particular about the FileSystemObject. First, let me describe what I need to do;
I need to output data from a form to a text file. The text file contains information, including title and revision, about the final document that my database creates. A seperate database system not written by me reads the text file to find out the information it needs to create issue sheets and issue history. My final document may be issued 5 or 6 times, maybe more. Each time it is issued it needs to reflect its new revision in the text file, adding a new line to the end. So on the first issue of the document, the text file would look like this;
Then the second revision might look like this;
But the the third may look like this, notice the status change;
My code so far is as follows;
To create and write the first two lines in the text file for the first issue;
To add a line to the end of the text file for subsequent revisions;
My problem is as follows - I can create the text file and add lines to it using information from my database, but how do I change the status, which is always on the first line of the text file? My table holding the revisions contains a status field, so the user must specify the status for each revision. That means that the first line of the text file must be modified every revision to reflect the status in the new revision, as well as adding the new line to the end to show the revision information. I have searched the web and this forum, but to no avail.
I hope this is clear. I really need some help on this so if it needs clearing up, let me know.
I need to output data from a form to a text file. The text file contains information, including title and revision, about the final document that my database creates. A seperate database system not written by me reads the text file to find out the information it needs to create issue sheets and issue history. My final document may be issued 5 or 6 times, maybe more. Each time it is issued it needs to reflect its new revision in the text file, adding a new line to the end. So on the first issue of the document, the text file would look like this;
Code:
RDS~EDINBURGH SCHOOL~ROOM DATASHEETS~A4~~INFORMATION~
*~C. DRAKE~10/04/2006~F. LEONARD~10/04/2006~~~
Then the second revision might look like this;
Code:
RDS~EDINBURGH SCHOOL~ROOM DATASHEETS~A4~~INFORMATION~
*~C. DRAKE~10/04/2006~F. LEONARD~10/04/2006~~~
1~A. MELICHAR~11/04/2006~C. DRURY~11/04/2006~~~
But the the third may look like this, notice the status change;
Code:
RDS~EDINBURGH SCHOOL~ROOM DATASHEETS~A4~~CONSTRUCTION~
*~C. DRAKE~10/04/2006~F. LEONARD~10/04/2006~~~
1~A. MELICHAR~11/04/2006~C. DRURY~11/04/2006~~~
2~C. DRAKE~14/04/2006~C. DRURY~14/04/2006~~~
My code so far is as follows;
To create and write the first two lines in the text file for the first issue;
Code:
Set fso = CreateObject("Scripting.FileSystemObject")
Set txt = fso.CreateTextFile("D:\RDS Base\RDS.rev", True)
txt.WriteLine ("RDS~PROJECT NAME~ROOM DATASHEETS~A4~~" & Status & "~")
txt.WriteLine (Revision & "~" & ModifiedName & "~" & ModifiedDate & "~" & AuthorisedName & "~" & AuthorisedDate & "~~~")
txt.Close
To add a line to the end of the text file for subsequent revisions;
Code:
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set fso = CreateObject("Scripting.FileSystemObject")
Set txt = fso.OpenTextFile("D:\RDS Base\RDS.rev", ForAppending, False)
txt.WriteLine (Revision & "~" & ModifiedName & "~" & ModifiedDate & "~" & AuthorisedName & "~" & AuthorisedDate & "~~~")
txt.Close
My problem is as follows - I can create the text file and add lines to it using information from my database, but how do I change the status, which is always on the first line of the text file? My table holding the revisions contains a status field, so the user must specify the status for each revision. That means that the first line of the text file must be modified every revision to reflect the status in the new revision, as well as adding the new line to the end to show the revision information. I have searched the web and this forum, but to no avail.
I hope this is clear. I really need some help on this so if it needs clearing up, let me know.
Last edited: