Funtion for making an error log

I'm fairly new to VB front end.  We are using VB 6.0 on a Sql Server.  I have been tasked to create a function to log all error messages, including date, time, screen, message, activity etc.

Would anyone be able to help me come up with an algorithm to do this?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Éric MoreauSenior .Net ConsultantCommented:
You can have a generic routine that will log errors but this sub will have to called from each error trapping in each sub of your application.

So a normal sub will look like this:

private sub MySub()
on error goto eh
   'the code of your sub here
exit sub

   call LogError(err,"MySub")
End Sub

Somewhere in a standard module:
Public sub LogError(pErr, pSource)
'you can do what ever you want here with the error
end sub
ambulanceAuthor Commented:
Okay, this will work.  At first I wasn't sure if placing that in 500+ error traps would be feasible, but yes it is.  

Now, one more quick question.  (If you don't mind, that is)  I need to open a text file, pass in the app.path (application path) and then the error log is to display a list of all errors received throughout the testing phase of this project.

What I need help with here, is just how to open the text file, and pass in the app.path.  I think I can figure out how to get it to display the log....

Thanks again
Éric MoreauSenior .Net ConsultantCommented:
Use this:

Open "Test.txt" For Output As #1
Print #1, "This is a test!!!"
Print #1, "This is a test!!!"
Print #1, "This is a test!!!"
Print #1, "This is a test!!!"
Close #1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ambulanceAuthor Commented:
thanks.  Ithink I have it figured out.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.