A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Write a variable value in a .txt file



 
 
Thread Tools Display Modes
  #1  
Old October 24th, 2006, 03:43 PM posted to microsoft.public.access.tablesdbdesign
acores
external usenet poster
 
Posts: 74
Default Write a variable value in a .txt file

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.

  #2  
Old October 24th, 2006, 08:16 PM posted to microsoft.public.access.tablesdbdesign
kingston via AccessMonster.com
external usenet poster
 
Posts: 620
Default Write a variable value in a .txt file

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.

acores wrote:
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.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...esign/200610/1

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:14 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.