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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replace IsNull Error

Status
Not open for further replies.
May 9, 2000
446
GB
Hi I've got some ASP code that copies data from one client to another client (it starts another record). I'm using 'replace' to deal any ' that users have entered but i'm getting an error. My code is:

Code:
If Trim(rsce.Fields.Item("workundertaken").Value)<>"" Then
	wu = replace(rsce.Fields.Item("workundertaken").Value,"'","''")
Else
	wu = (rsce.Fields.Item("workundertaken").Value)
End If

The error is:

Microsoft VBScript runtime error '800a005e'

Invalid use of Null: 'replace'

/internalaudit/CopyRep.asp, line 152


Can anyone help me out with this?

Cheers
 
try:

Code:
If Trim(rsce.Fields.Item("workundertaken").Value)<>"" and not isnull(rsce.Fields.Item("workundertaken").Value) Then
    wu = replace(rsce.Fields.Item("workundertaken").Value,"'","''")
Else
    wu = (rsce.Fields.Item("workundertaken").Value)
End If
 
Is it possible that rsce.Fields.Item("workundertaken") has a null value? If so, then you need to account for this because null is not the same thing as "".

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top