Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

How to Create a LOGFILE

:confused: Hi!
Can any one help me out... i want to create a Log File for my Access database,, i dont know where to start.,,
Kind Regards
Andrew
NB: i'll appriciate your support..
[212 byte] By [bazo] at [2007-11-11 8:45:19]
# 1 Re: How to Create a LOGFILE
You need to use VB to create a function that will write out your log file. There is a built-in VB object (FileSystemObject) that can be used to open, read and write to files.

Here is a simple example from the Help files built into Access 2002:

Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("c:\testfile.txt", True)
a.WriteLine("This is a test.")
a.Close

Here is an example of reading in a preexisting file:

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
KalebZen at 2007-11-11 23:47:04 >