Desktop User Guides > Professional > Interview scripting > Writing interview scripts > Events > OnInterviewEnd event
 
OnInterviewEnd event
The OnInterviewEnd event runs when an interview stops, times out or completes, and is typically used to clean up objects created in OnInterviewStart.
To define actions for the end of an interview, place the following statements in the routing section of the script:
Sub OnInterviewEnd(IOM)
  statements
End Sub
where:
statements are interview scripting or mrScriptBasic statements that define the actions to be carried out.
IOM is the interview object. This gives the event access to all the properties and objects related to the interview.
Here’s an example that closes an ADO recordset that was created at the start of the interview so that response lists could be created from records in an SQL database:
Sub OnInterviewEnd(Interview)
  Dim rsLongBrandList
  Set rsLongBrandList = Interview.Objects["rsBrandList"]
  rsLongBrandList.Close()
End Sub
Refer to Paradata example script for an example of using OnInterviewEnd to write data collection information for the interview as a whole to a database.
See also
Calculating the total time taken to complete interviews
Events