Write a variable value in a .txt file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello.
Can anyone tell me (very slowly, please), how can I store a variable in a
..txt file?
I want the user to choose a path to a specific folder, and I want to store
that path for every time the user opens the database, unless he change it
again.
Thanks in advance for the help.
 
Look up the OpenTextFile method:

Sub OpenTextFileTest
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Dim fs, f
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("c:\testfile.txt", ForAppending,TristateFalse)
f.Write "Hello world!"
f.Close
End Sub

However, have you considered storing this string in a table in the FE
application? You can create a table and keep just one record in it or more
if you have many such stored variables. Then the application would be fully
self-contained and there would be less chance of the variable being deleted,
lost, etc.
 
Back
Top