<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><!-- InstanceBegin template="/templates/function.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Database Objects</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<link href="default.css" rel="stylesheet" type="text/css">
</head>
<body>
<h1>
<h1><!-- InstanceBeginEditable name="heading" -->DatabaseObjects<!-- InstanceEndEditable --></h1>
<h3><!-- InstanceBeginEditable name="subheader" -->ObjectItem(<span class="keyword">ByVal</span> objCollection <span class="keyword">As</span> IDatabaseObjects,
<span class="keyword">ByVal</span> vIndex <span class="keyword">As Variant</span>) <span class="keyword">As</span> IDatabaseObject<!-- InstanceEndEditable --><br>
</h3>
</h1>
<!-- InstanceBeginEditable name="text" -->
<p>ObjectItem either calls the ObjectByOrdinal
or ObjectByKey functions depending on the vIndex data type. If vIndex is
an integer or long then the ObjectByOrdinal function is called.
If
vIndex
is
any
other
data type then the ObjectByKey function is called. The example below demonstrates
the two uses of this function.</p>
<!-- InstanceEndEditable --><font face="Courier New, Courier, mono">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#f6f6f6"><pre><!-- InstanceBeginEditable name="example" --><span class="comment">
'Example 1<font face="Courier New, Courier, mono"> - Utilises the ObjectByOrdinal function</font></span>
<span class="comment">'Return <font face="Courier New, Courier, mono">the 10th product in the collection</font></span>
<span class="keyword">Set</span> Product = DBO.ObjectItem(objProducts, 10)
<span class="comment">'Example 2 - Utilises the ObjectByK<font face="Courier New, Courier, mono">ey function</font></span>
<font face="Courier New, Courier, mono">
<span class="comment">'Return product with product code "ABC"</span></font>
<span class="keyword">Set</span> Product = DBO.ObjectItem(objProducts, <font face="Courier New, Courier, mono">"ABC"</font>)
<span class="comment">'<font face="Courier New, Courier, mono">Typically, the </font>function is <font face="Courier New, Courier, mono">used in the manner below</font>.
'For <font face="Courier New, Courier, mono">example, in the Products class the following would be used</font></span>
<span class="comment">'to access either <font face="Courier New, Courier, mono">a product by an ordinal number or by the </font>
'product's key field<font face="Courier New, Courier, mono">; the product code</font></span>
<br><span class="keyword">Public Property Get</span> Item(<span class="keyword">ByVal</span> vIndex <span class="keyword">As</span> Variant) <span class="keyword">As</span> Product<font face="Courier New, Courier, mono">
</font>
<span class="keyword">Set</span> Item = <font face="Courier New, Courier, mono">DBO</font>.ObjectItem(Me, vIndex)<br> <br><span class="keyword">End Property</span>
<br><!-- InstanceEndEditable --></pre></td>
</tr>
</table>
</font>
<p> </p>
<p align="center"><font size="1">� Hi Integrity Systems 2005. All rights reserved.</font></p>
</body>
<!-- InstanceEnd --></html>