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

Clean Input function and memo fields

Status
Not open for further replies.

Anthony1312002

Programmer
Mar 4, 2004
146
US
I'm using a CleanInput function to post data to fields in a db table. Everything works fine until I try to post to a memo field. For example, in the case below the memo field "ClientName" is ignored while the rest of the form is processed. Text fields and numerical fields are updated with no problem. What changes need to be made to make it possible to update the memo field as well? By the way, this is an Access db.

'This function is used to reduce the number of times we have to type Request.Form and Replace functions
Function CleanInput(strReqName)
CleanInput = Replace(Request.Form(strReqName),"'","''")
End Function


sql_update = "UPDATE CustomerMatrix SET ClientName = '" & CleanInput("txtClientName_" & id) & "', " & _
"AvgMonthlyVol = '" & CleanInput("txtAvgMonthlyVol_" & id) & "', " & _

 
You are missing the double quotes:

Request.Form("strReqName")

-L
 
No, that's not the problem. In the function strReqName is a valid variable.

For reasons unknown, it's best to put memo fields last in your SQL when using ADO. Not sure why it has an effect, but since a Microsoft dude gave me that tip lo some 6 or so years ago, it's solved a lot of problems. You might try that.
 
also, it could depend on the form side of things, if you're not handling quotes properly, you could be losing the data, also memo fields will act as empty if checking against them, on your form you might need to assign it to a variable for content validation.

i dont know what your input side of things look like but the update statement above looks ok and so does the function.

of course, gen's suggestion is also a good idea, especially since memo/textareas can exceed the variable size and get truncated, if they're on the end it's easier to trouble shoot.

[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top