Professional > Interview scripting > Writing interview scripts > Events > OnInterviewStart Event
 
OnInterviewStart Event
The OnInterviewStart event runs when an interview starts or restarts. If your script uses an ADO recordset or an ODBC database you can make the connection to that recordset or database by placing the appropriate statements in this event.
To define actions for the start of an interview, place the following statements in the routing section of the script:
Sub OnInterviewStart(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.
Example
This example creates an ADO recordset from an SQL database. The records can then be used later in the script to set up the response list to a question:
Sub OnInterviewStart(IOM)
Dim rsLongBrandList
Set rsLongBrandList = CreateObject("ADODB.RecordSet")
rsLongBrandList.Open("SELECT Brand FROM Brands",_
"Provider=SQLOLEDB.1;Data Source=SVR1")
IOM.Objects.AddNew("rsBrandList", rsLongBrandList)
End Sub
For an example of using OnInterviewStart to create a database that can be used for storing paradata about the data collection process, see Paradata example script.
See also
Objects
OnInterviewEnd event
Calculating the total time taken to complete interviews
Events