Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. strSQL = "SELECT * FROM TblOrder ORDER BY ID"
  2.  
  3. Set rs = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
  4.  
  5. rs.FindFirst ("Len(string) > 13")
  6. If rs.NoMatch Then
  7. MsgBox "All good"
  8. Else
  9. Do While Not rs.NoMatch
  10. MsgBox "String over 13 - " & rs.AbsolutePosition + 1
  11. rs.FindNext ("Len(string) > 13")
  12. Loop
  13. rs.FindNext ("Len(string) > 13")
  14. End If
  15.  
  16. rs.FindFirst ("Validation(string, ""123d{10}$"") = False")
  17. If rs.NoMatch Then
  18. MsgBox "All are correct pattern"
  19. Else
  20. Do While Not rs.NoMatch
  21. rs.FindNext (Validation(string, "123d{10}$") = False)
  22. MsgBox "Must start with 978 - " & rs.AbsolutePosition
  23. Loop
  24. rs.FindNext (Validation(string, "123d{10}$") = False)
  25. End If
  26.  
  27. If Validation(rs!string, "978d{10}$") = False Then
  28.  
  29. Dim regex As Object
  30. Set regex = CreateObject("VBScript.RegExp")
  31.  
  32. With regex
  33.  
  34. .Pattern = strPattern
  35. .IgnoreCase = True
  36. .Global = False
  37. .MultiLine = False
  38. End With
  39.  
  40.  
  41. If regex.Test(StrInput) = True Then
  42. Validation = True
  43.  
  44. Else
  45. Validation = False
  46.  
  47. End If
  48.  
  49.  
  50.  
  51. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement