User Entry - Punctuation Checking

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Every now and then someone using my database will enter in an apostrophe
and/or a quotation mark into a text field. Of course, when this happends,
the entire database goes straight to shit and crashes, because those symbols
are used in commenting and string separation in the code.

I need to somehow check for certain punctuation when the user enters data to
the field, and stop the running code when it finds a bad string. Any ideas?

Nick
 
create a sub rountine that strips those fields from the data and call
it in the beforeupdate event of whatever field you have having problems
with.

Sub StripBad(passcircuit)
tempfld = ""

strlen = Len(passfield)
if strlen > 0 then
For cnt = 1 To strlen
If Mid(passfield, cnt, 1) = "'" Or
Mid(passfield, cnt, 1) = """ Then
'increment loop
Else
tempfld = tempfld & Mid(passfield, cnt, 1)
End If
Next I
passfield = tempfld
endif
End Sub

Ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top