Results 1 to 5 of 5

Thread: How to log to server's event log?

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2007
    Location
    Shawnee KS
    Posts
    6

    How to log to server's event log?

    Hi all,

    I'm writing a VBA Access 2003 app which will have to log an event to the event log of the server it runs on, so that it'll be visible from the Event Viewer. I just can't find any examples of this; can anybody tell me how, or point me towards an example? Many thanks in advance... - LenexaKS

  2. #2
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: How to log to server's event log?

    There's a set of event logging APIs you can use. See here: http://msdn2.microsoft.com/en-us/lib...81(VS.85).aspx

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: How to log to server's event log?

    Quote Originally Posted by LenexaKS
    I'm writing a VBA Access 2003 app
    Moved To Office Development

  4. #4

    Thread Starter
    New Member
    Join Date
    Apr 2007
    Location
    Shawnee KS
    Posts
    6

    Re: How to log to server's event log?

    Thanks, Doogle! I'll give it a try.

  5. #5

    Thread Starter
    New Member
    Join Date
    Apr 2007
    Location
    Shawnee KS
    Posts
    6

    Re: How to log to server's event log?

    Details/Summary for future searchers:

    Create a VBScript file, eg, scriptname.vbs:
    Dim WshShell
    Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.LogEvent 0, WScript.Arguments(0)

    In the VBA code, do:
    Shell "Wscript.exe C:\[path]\scriptname.vbs " & YourEventText

    YourEventText will probably be multiple words, so group the whole event message string in double quotes first, or it'll treat it as multiple incoming arguments:
    MessageText = """" & MessageText & """"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width