AnswerCollection.Item Method

This method retrieves an Answer object from the AnswerCollection object.

The use of repeat indexes is not recommended with this method.

Syntax

object Item ( object index , HotDocs_Online.ansType VarType)

Parameters Description
index Either a number representing the position of the desired Answer object in the collection, or a string (VT_BSTR) representing the name of the desired Answer object. If index is a string, then varType must be set correctly also.
VarType [optional] This is a value from the ansType enumeration corresponding to the variable whose answer is desired. It is only required if the index parameter is a string (variable name).
repeatIndex1 [deprecated] First repeat index for the answer to be returned.
repeatIndex2 [deprecated] Second repeat index for the answer to be returned.
repeatIndex3 [deprecated]Third repeat index for the answer to be returned.
repeatIndex4 [deprecated] Fourth repeat index for the answer to be returned.

Return Value

A specific Answer object from the AnswerCollection. If the repeat indexes are omitted, the answer object returned will represent the first value (-1, -1, -1, -1).

Example

'This example uses a number value in the index parameter.
Dim ac
Dim ans
Set ac = Server.CreateObject("HotDocs_Online.AnswerCollection")
ac.Open "C:\test templates\demoempl.anx"
For i = 0 To ac.Count - 1
    Set ans = ac.Item(i)
    Response.Write "<br>" + ans.Name
Next
ac.Close
 
'This example uses a string value (variable name) in the index parameter.
Dim ac
Dim ans
Set ac = Server.CreateObject("HotDocs_Online.AnswerCollection")
ac.Open "C:\test templates\demoempl.anx"
Set ans = ac.Item("DadNum", ansTypeNumber)
Response.Write "<br>" + ans.Name a
c.Close