type mismatch with the MID function

I cannot figure this out.

I have a string called mmsg. I want to test to see if I have a CRLF as the char and have the code as follows:

dim i
dim mmsg

mmsg = request.form("message")

for i = 1 to len(mmsg)
       if asc(mid(mmsg,i,1)) = 13 then
            response.write blah,blah,blah"
       end if
next

I keep getting a type mismatch on the line that has the mid(mmsg,i,1) and I know that there is data in mmsg and the len(mmsg) is working correctly because I am able to write out it's contents before I get into the loop.

Any one know why? I am stumped.
   
LVL 13
samic400Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Lee W, MVPTechnology and Business Process AdvisorCommented:
Why not just use instr?

If Instr(Request.form("message"), vbCrLf) > 0 Then
    'A CRLF character was found
End If

If you JUST want the CR character, use vbCr
0
samic400Author Commented:
The problem is I need to read the data and if there is a vbCR found, then I need to substitute it with a <br><br> because I am going to store it in a database and if it needs to be read in the future, then I need to have the breaks in the string.
0
Lee W, MVPTechnology and Business Process AdvisorCommented:
No problem... use replace.

When storing it in the database, reference it as Replace(Request.Form("message"), VbCrLf, "<br><br>")
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
samic400Author Commented:
Thank you. The REPLACE worked great. I appreciate your help. Always is nice to have another person's point of view :-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.