Module needed for "random 6 string" search

Yes, but since the field, I need to compare the client-number with, in its imported state looks something like: "DimvlaanA23142Order#722638445" I need to separate the client number first - then I can do the query and verify the correctness.
Does that make sense? Anyway, I found the solution, I was searching for, and that is what matters most. Thanks for your - and all the others' participation.

Please post your solution for the benefit of others ?
 
Sure, here is what I did:

Module:

Code:
Option Explicit

Function regexp(StringToCheck As Variant, SearchPattern As String, Optional CaseSensitive As Boolean = True)

  Dim re As New regexp
  re.Pattern = SearchPattern
  re.Global = False
  re.IgnoreCase = Not CaseSensitive
  Dim m
  For Each m In re.Execute(StringToCheck)
    regexp = m.Value
  Next
End Function

In the query, I use this to separate the client number from the rest:

Code:
Client_ID: if(RegExp([originalfield];"[a-z]\d{5}";false)<>" ";RegExp([originalfield];"[a-z]\d{5}";false);"control_it")

Which give me a perfect overview of those who have entered a correct client id and those, who didn't.
Those that didn't, are checked if an ordernumber exists, and if, I combine them to our db. If not, they will be put in a report for the user to check.

Thanks again!
 
Thanks for posting solution.

Good to see that regex() did in actual fact solve your problem.
 

Users who are viewing this thread

Back
Top Bottom