I don't understand your question, could you elaborate a little more? Table/query/form/control/field names are helpful as well as examples. Joe Miller
joe.miller@flotech.net
Well I have a website with a form that puts the user data into the database.
the fields are NAME,ADD,COMMENTS
Really what I want is that if they enter a bad word into the comments field Access will change that word to lets say ****
So I would have a list of pre determined words which it would change
But im not sure you are able to do that in Access
If not what I can do at the moment is open the table in design view and edit the Comments field with the validation key but it only seems to work for one word and not multiple.
Thanks
Nick
Not sure if this helps but, this function will search a string for a substring and allow you to replace it with another string. You can run a loop that checks each value in your "bad word" table and run it against the string.
[tt]
Function fstrTran(ByVal sInString As String, _
sFindString As String, _
sReplaceString As String) As String
Dim iSpot As Integer, iCtr As Integer
Dim iCount As Integer
iCount = Len(sInString)
For iCtr = 1 To iCount
iSpot = InStr(1, sInString, sFindString)
If iSpot > 0 Then
sInString = Left(sInString, iSpot - 1) & _
sReplaceString & _
Mid(sInString, iSpot + Len(sFindString))
Else
Exit For
End If
Next
fstrTran = sInString
End Function
[/tt]
Sample Usage
Result = fstrTran(MyString,"BadWord", "B******"
The is not the complete solution, simply a part of it. As for where the code goes, I have no idea, you'll have to answer that question. I have little experience with using Access as a backend for web pages so I can't help you there. I would venture to guess that you have some kind of import or posting process to put the data in your tables. This process should be done before that point in time.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.