Write a variable value in a .txt file

A

acores

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.
 
K

kingston via AccessMonster.com

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top