The following code example is for an event handler that obtains the globally saved reference to the event server object, then calls DBClose()to close down the connection to the database.
Select JobStopped as the event and enter the code using the Visual Basic window. The event is called when all forms in a job have been processed.
Function OnJobStopped ( ) As Long
Dim db As Object
Set db = Application.GetSharedObject( "EHFDB", 1 )
db.DBClose
OnJobStopped = EV_OK ' Return value to FORMS
End Function