Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Type Mismatch

Status
Not open for further replies.

discusmania

IS-IT--Management
Oct 24, 2000
158
AP
Hi All... ihave the codes below but it will give me this error when i ran it:

Microsoft VBScript runtime error '800a000d'

Type mismatch

/dept/AMT/Software/causes/quality_measurement.asp, line 225

where line 225 is: dpku=no_defect/total_handle * 1000

please help me to rectify what's the problem

regards, Ron

function query_dpku(weekend_str,year_str,crew,area,line)
dim weekend
if not opendb_mdamqs then response.end

cmd1="select count(defect) no_of_defect,process from defects where substr(fe_shift,3)='"&crew&"'" &_
" and fe_shift is not null and length(fe_shift)=3 "&_
" and testdate BETWEEN to_date('"& start_date & " 00:00:00','dd-mon-yyyy hh24:mi:ss') AND" &_
" to_date('" & end_date & " 23:59:59','dd-mon-yyyy hh24:mi:ss') "&_
" group by process, fe_shift"
response.write cmd1 &&quot;<br>&quot;
set rsdefect=cn4.execute(cmd1)
aDefect=rsdefect.getrows

cmd2=&quot;select sum(phand) total_handle, process from sm_track where &quot; &_
&quot; datetime BETWEEN to_date('&quot;& start_date & &quot; 00:00:00','dd-mon-yyyy hh24:mi:ss') AND&quot; &_
&quot; to_date('&quot; & end_date & &quot; 23:59:59','dd-mon-yyyy hh24:mi:ss') &quot;&_
&quot; group by process&quot;

Response.Write cmd2
set rshand=cn4.execute(cmd2)
aHand=rshand.getrows
for i=0 to ubound(aHand,2)
station_h=aHand(1,i)
total_handle=aHand(0,i)

for j=0 to ubound(aDefect,2)
station_d=aDefect(1,j)
'Response.Write &quot;<br>&quot; & station_d & &quot;STATION D&quot;
no_defect=aDefect(0,j)
if strcomp(station_h,station_d)=0 then
if (no_defect<>&quot;0&quot; and total_handle<>&quot;0&quot;) then
Response.Write &quot;<br>&quot; & no_defect &&quot;/&quot; & total_handle
dpku=no_defect/total_handle * 1000
Response.Write &quot;<br> DPKU: &quot;&dpku
end if
end if
next
next

end function
 
try cint(no_defect)/cint(total_handle) * 1000

The type mismatch error is occuring because you are trying to perform a calculation on string variables.

Hope this helps

N
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top