VBA IE Onclick Function Call
<p>Fellows,</p>

<p>I was trying to do IE automation with VBA. Everything worked as I wanted until I got to this problem.
<a href="http://i.stack.imgur.com/UnvV7.png" rel="nofollow">Enter item no in a input text filed, and then click on link 'RUN Report' to get the report.</a></p>

<p><strong>Problem:</strong> After clicked on 'RUN report', the report was not pulled for the Item No I entered in the text filed. But a report for all items in database.</p>

<p><strong>Possible cause:</strong>
There is a onclick function in the link, I am not sure if this function is called when "<strong>IE.Doucument.getElementById(runReportID).Click</strong>" is executed. I also tried "<strong>IE.Document.getElementById(runReportID).FireEvent("onclick")</strong>" and "<strong>IE.Document.parentWindow.execScript("return ValidateDate();", "JavaScript")</strong>", unfortunately, they didn't work.</p>

<p>And I don't know how to pass the value I entered in text field to the function when "Run Report" button is clicked. Is there an event in that text filed to do this job?</p>

<p>HTML code for link 'RUN Report' and text field:</p>

<pre class="lang-html prettyprint-override"><code>&lt;A onclick="return ValidateDate();" id=spsCtrlDefault_ctl02_lbtn_run_qry_rpt title="Click to run report" style="CURSOR: hand; TEXT-DECORATION: none; HEIGHT: 14px; FONT-FAMILY: ariel; FONT-WEIGHT: bold; COLOR: #0033ff" href="javascript:__doPostBack('spsCtrlDefault$ctl02$lbtn_run_qry_rpt','')"&gt;[ Run Report ]&lt;/A&gt;
&lt;input id="spsCtrlDefault_ctl02_gvQueryColumns_ctl02_txtItem_Code" name="spsCtrlDefault$ctl02$gvQueryColumns$ctl02$txtItem_Code" size="20" class="riTextBox riEnabled" type="text" req_ind="N" tbl_idn="2" value="947519" controltype="text" datatype="varchar" col_idn="1" dbfld="item_revision.item_cde" style="text-transform: uppercase;"&gt;
&lt;input id="spsCtrlDefault_ctl02_gvQueryColumns_ctl02_txtItem_Code_ClientState" name="spsCtrlDefault_ctl02_gvQueryColumns_ctl02_txtItem_Code_ClientState" type="hidden" autocomplete="off" value="{&amp;quot;enabled&amp;quot;:true,&amp;quot;emptyMessage&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;validationText&amp;quot;:&amp;quot;TESTVALUE&amp;quot;,&amp;quot;valueAsString&amp;quot;:&amp;quot;TESTVALUE&amp;quot;}"&gt;
</code></pre>

<p>VBA code for link click:</p>

<pre class="lang-vb prettyprint-override"><code>IE.Document.getElementById(runReportID).Click
</code></pre>