How can I set the citeria to search on the second value of a string. ie I
have a series on four digit numbers formated as text 1201 2201 3201 2204 2401
[quoted text clipped - 4 lines]
It sounds like you have one text field containing multiple numbers,
separated by blanks; and that you want to search the table for the
second of those numbers. Am I understanding you correctly?
If so, you're having difficulty because you're violating a very basic
principle of database design: fields should be ATOMIC.
If you have a one to many relationship from this table to a series of
numbers, model it *as a one to many relationship*, with TWO tables,
and one record for each of these numbers.
With your current hodgepodge, you will almost certainly need some VBA
code to extract the desired value. Untested air code: put the
following into a new Module; save the module as basQSplit:
Public Function QSplit(vField As Variant, _
iWhich As Integer, _
sDelim As String) As Variant
Dim vAns() As Variant
vAns = Split(vField, sDelim)
If UBound(vAns) >= iWhich - 1 Then
QSplit = vAns(iWhich - 1)
Else
MsgBox "Too few values in array"
QSplit = Null
End If
End Function
This will use the builtin Split function to return any selected
substring. Call it in a query with
SecondNumber: QSplit([yourfieldname], 2, " ")
Use "," if your numbers are delimited by commas instead of blanks,
etc.
John W. Vinson[MVP]