/    Sign up×
Community /Pin to ProfileBookmark

Microsoft VBScript runtime error ‘800a000d’ – – Please advice on code

Hi guys,

i have this function to save the data in an MS-Database. The function is accessed from the web. In the case where the fields in the table are already empty (NULL), then i get this error:

Microsoft VBScript runtime error ‘800a000d’

Type mismatch: ‘ccur’

/databaseadmin.asp, line 669


—————————————————————–

here is the code:

Sub SaveRec
‘Save the record to the table’
OpenCon
ChooseSQL “Select * from ” & sTable & ” where(ID=” & sID & “)”
if sID = 0 then
rs.addnew
else
rs.movefirst
end if

For i = 0 to rs.fields.count – 1
If CBool(rs.fields(i).Attributes And adFldUpdatable) then
‘set the field value’
select case rs.fields(i).type
case adBigInt
rs.fields(i).value = csng(Request.Form(rs.fields(i).name))
case adBoolean
if trim(Request.Form(rs.fields(i).name) = “”) then
rs.fields(i).value = False
else
rs.fields(i).value = True
end if
case adCurrency
rs.fields(i).value = ccur(Request.Form(rs.fields(i).name))
case adDate,adDBDate,adDBTime,adDBTimeStamp
rs.fields(i).value = cdate(Request.Form(rs.fields(i).name))
case adDecimal
rs.fields(i).value = cdec(Request.Form(rs.fields(i).name))
case adDouble
rs.fields(i).value = cdbl(Request.Form(rs.fields(i).name))
case adInteger
rs.fields(i).value = cint(Request.Form(rs.fields(i).name))
case adSingle
rs.fields(i).value = csng(Request.Form(rs.fields(i).name))
case else
rs.fields(i).value = Request.Form(rs.fields(i).name)
end select
end if
next
rs.UpdateBatch adAffectAll
CloseCon
%>
Your record has been saved.<BR>
<%
WriteLink “?action=listrec&table=” & sTable,”Click here to continue.”,”<BR>”

End Sub
—————————————————

How can i fix this? The easiest solution would be in case the field is already empty, then go to the next entry of the table

any advice guys?

thanks in advance

to post a comment

2 Comments(s)

Copy linkTweet thisAlerts:
@buntineJul 04.2005 — You need to ensure the value is numeric.
<i>
</i>If Not IsNumeric(Request.Form(rs.Fields(i).Name))) Then
' The value is invalid. <br/>
End If

You could also just check if its empty.
<i>
</i>If Request.Form(rs.Fields(i).Name)) &lt;&gt; "" Then
'| The value is valid.
End if

Regards.
Copy linkTweet thisAlerts:
@BullschmidtJul 05.2005 — And here's a related link:

Why do I get errors in the 800A0001 -> 800A000F range?


http://www.aspfaq.com/show.asp?id=2389
×

Success!

Help @Foundas spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...