Q: Error.log
    I am trying to create an error log file, for the testing phase of my
application. I want to be able to check and see if the error.log file
exists. This would be in the login screen, with a checkbox called Check
Diagnostics. The users can check the checkbox. If the checkbox is
vbchecked then I want to see if the error.log exists in the directory of
my application. If it exists then delete the old one and create a new
one, if it does not exist then create a new one.

    Secondly, I have several forms (nine), if the diagnostics is turned
on I want to record everything the user does into this log, this
includes the data entered. How do I keep track of the log file through
all the forms and also have it in append mode? When the logfile is first
created I want to enter the Title of the Application, the date and time
it was started and the userid and password of the person, using the
application. I saw your example on using the open filename as #1 and
write example.


Kumar Kashyap; kumar_kashyap@mortgage.ge.com
- check the file http://www.kather.net/VisualBasicSource/vbbestaatfile.txt
for checking the existing of a file
- to delete an existing file just use the command Kill [filename]
- if the logfile is in the executable directory use the command App.Path
- check the file http://www.kather.net/VisualBasicSource/vb4writelogfile.txt

Instead of setting the parameter '/D' for logging you make a global 
variable like blnLogging. In the checkbox you set the blnLogging to 
true when it is checked.
In the code you change the line  'If InStr(UCase$(Command$), "/D") Then' 
to 'If blnLogging Then'.

Just set in every action (event) you want to log the command:
Call WriteLogFile(screen.activeform.name) This will give you the 
current form. Also remember it's a string so you can log anything you 
want: Call WriteLogFile(usernaam + "logged in") or  Call 
WriteLogFile(usernaam + "logged out"). I use this in almost all my 
applications; it's necessary for the finaciel department to know who 
did what....
I also log mutations, deletes, new records etc. It will not slow down 
your application.. only the logfile can grow very quick en get big..