I am trying to validate entry of a form field using the following VBA. This works very well. My problem is this Access app creates a variety of XML data files, and I don't want certain characters within that xml....namely soft-returns (Shift+Enter). I believe that the Chr for this is Chr(11), but I don't think I can just add , Chr(11)) to the end of the array below and this will work...how can I use Chr(#) in link manner?
Dim i, j As Integer
dim myField as variant
varNo = Array("\", "/", ":", "*", "?", """", "<", ">", "|")
If IsNull(Me.FieldValue) = False Then
myField = Me.FieldValue
For i = 0 To UBound(varNo)
j = InStr(1, myField , varNo(i))
If j > 0 Then
MsgBox "Cannot use character:" & Chr(13) & Chr(10) & Chr(13)
& Chr(10) & varNo(i), vbCritical, " Illegal Character"
Exit Sub
Exit For
End If
Next
End If
again the above works great for those things in the array, but I would like to include Chr() as well.