-
I am using the following code to add a string of text to a file which already contains some data. But when I enter any string to the file, the old data gets erased out and only the new string is left.
The code:
Private Sub cmdAdd_Click()
dim strAdd as string
strAdd = Text1 & Text2
open App.Path & "\Test.txt" for Output as #1
Print #1, strAdd
close #1
End Sub
How do I modify my code to write the new string after the end of existing data in the file.
Thanks
:p Kinjal :p
-
here you go:
Code:
Private Sub cmdAdd_Click()
dim strAdd as string
strAdd = Text1 & Text2
open App.Path & "\Test.txt" for Append as #1
Append #1, strAdd
close #1
End Sub
-
Wrong way dimava.
Code:
Private Sub cmdAdd_Click()
dim strAdd as string
strAdd = Text1.text & Text2.text
open App.Path & "\Test.txt" for Append As #1
Print #1, strAdd
Close #1
End Sub
-
for some reason, today I've been making those little mistakes all day.
-
Thanks a lot both of you. It really solved my problem.
Thnaks a lot once again.
:p Kinjal :p