Add a temp column to your query grid. This column will be populated
with only a string of 10 numeric chars. The way you will populate this
column is by writing a function as follows which will take values from
your actual column in question. The function will parse the values for
each row, and if there is a string containing 10 consecutive digits that
value will be added to the temp column otherwise the function returns
"".
In the field name add this:
temp:getNum(yourActualfieldnamehere)
Under the criteria for temp add:
<> ""
This will yield a resultset where only rows that contain values from
your actual column that are 10 consecutive numeric chars.
Here is a function that does this:
'******************************************
Function getNum(x As Variant) As Variant
Dim i As Integer, j As Integer, k As Integer, y As Variant
For i = 1 To Len(x)
y = Mid(x, i, 1)
If j = 0 And IsNumeric(y) Then j = i 'beginning of number
If j > 0 And Not IsNumeric(y) Then
k = i - 1
Exit For
End If
If j > 0 And i - j + 1 = 10 Then
k = i
Exit For
End If
Next
If k - j - 9 = 0 Then getNum = Mid(x, j, 10)
End Function
'************************************************* ***
It isn't pretty, but it is functional, and Free! This function will
return values like these
1231231234, 1234567890
from xx1231231234 or 1231231234xxx or aaa1234567890kkk
and will not return values like these
123123123 (only 9 digits)
or 1 231231234 (a space breaks the continuity)
or xxx12312312x3 (not 10 consecutive digits)
based on your specifications. You can place this function in a standard
code module (not a form code module) so that the query can access it.
Rich
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!