views:

168

answers:

1
+3  Q: 

Event Log in VBA

Is there an easy way to write to and read from the windows event log in VBA?

+1  A: 

Yes, using the standard API calls. See HOWTO: Write to the Windows NT Event Log from Visual Basic This is fairly old but should get you started.

Note, however, that this code uses a default source. (Run the event log to see what I mean by source.) I haven't run tihs code in Access so I don't know what the default source is for Access. In VB6 thuogh it was something generic with VB 6 runtime or some such. If you visit the thread ReportEvent and MessageDLL problem Options it states you need to run an install program with admin privileges to add your app name and path to   HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\ So this could get even more complex when it comes to getting a distinguishable source in the event log.

Tony Toews
exactly what I needed, thanks. Good note about the source too
Nick