Hi all, I have a piece of code that writes fields to a text file when the command button is clicked by the user. The problem is, every time the user clicks the command button it writes the fields to the text file again..and again..and again..
What I would like it to do, is when the user clicks the command button, it writes once, and if it is clicked again, it overwrites what is previously written...
Code:Private Sub Command1_Click() Dim path As String path = "C:\test.INI" ' Where the file is written to. Dim ss As String ss = FreeFile If FExist(path) Then Open path For Append As #ss Else Open path For Output As #ss End If Print #ss, Name.Text ' Fields written Print #ss, PhoneNumber.Text Print #ss, Address.Text Close #ss End Sub





Reply With Quote
