Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing to the Application Event Log

Status
Not open for further replies.

GabeC

Programmer
Apr 17, 2001
245
0
0
US
Does anyone have a code sample to write to the Application Event Log?

I am using MS Access 2003 and VBA.

Thanks for your help.

Thanks,

Gabe
 
Something like this?
Transaction Log for Ms. Access
faq181-291
 
Thank you both for your response.

I don't think I have been clear on what I am trying to do.

Right click My Computer then click Manage.

Expand the Event View branch under Systems Tools.

Click Application.

This shows a list of application events. I need to be able to write to this event log.

In VB 6.0 I can write the code
App.LogEvent "My Event Message", vbLogEventTypeInformation
App.LogEvent "My Event Message", vbLogEventTypeWarning
App.LogEvent "My Event Message", vbLogEventTypeError

All the computers I need to do this on are running Windows XP.



Thanks,

Gabe
 
Do I need to add WshShell as a reference?

Here is the code:

Dim ws As WshShell
Set ws = New WshShell
ws.LogEvent 1, "Logon Script failed"

Here is the error I am getting:

Compile error:
User-defined type not defined


Thanks,

Gabe
 
Yes. The reference is:
Windows Script Host Object Model
 
A method without adding references:
Dim ws As Object
Set ws = CreateObject("WScript.Shell")
ws.LogEvent 1, "Logon Script failed" ' 1=ERROR

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top