The following code example is for an event handler that creates an instance of the event server object, connects to it, informs FORMS that the object is an event server, and finally saves it globally so that the handler for the JobStopped event can access the object.
Select JobStarted as the New event and enter the code using the Visual Basic window.
The event handler is called when a job is started, before any forms have been processed.
Function OnJobStarted ( ) As Long
Dim db As Object
Set db = CreateObject( "Sample.EventServer" )
db.Connect( Application, "c:\DB\Sample.mdb" )
Application.SetEventServerObject( db )
Application.SetSharedObject( "EHFDB", db )
OnJobStarted = EV_OK ' Return value to FORMS
End Function
Another example of setting an ActiveX object as FORMS' event server