This does not seem very efficient...
SELECT [import].[item], [new billing].[new style]
FROM [import] INNER JOIN [new billing]
On
fGetFirstChars_Nums_w([import].[item]) =
fGetFirstChars_Nums_w([new billing].[new style]);
Is there a chance you could add a field
(say "MatchString") to each table?
Then, you could run update queries on each
table using the function...
UPDATE [import]
SET MatchString =
fGetFirstChars_Nums_w([item]);
UPDATE [new billing]
SET MatchString =
fGetFirstChars_Nums_w([new style]);
then, a parameter query would be really fast:
SELECT
[import].[item],
[new billing].[new style]
FROM
[import] INNER JOIN [new billing]
On
[import].MatchString = [new billing].MatchString
WHERE
[import].[item] = [Please Enter import item];
///////////////
or...you could have main form bound to [import]
and subform bound to [new billing],
then set your "Master/Child" form/subform link
on the MatchString fields.
so you select an [import] record in main form,
and matching [new billing] record(s) appear in subform...
Gary Walter said:
Public Function fGetFirstChars_Nums_w(pString As Variant) As String
On Error GoTo Err_fGetFirstCharsNums
Dim i As Integer
Dim boolNum As Boolean
Dim ch As String
Dim tmp As String
If Len(Trim(pString & "")) > 0 Then
For i = 1 To Len(pString)
ch = Mid(pString, i, 1)
Select Case ch
Case "0" To "9"
If boolNum = False Then boolNum = True
tmp = tmp & ch
Case "w"
tmp = tmp & ch
If boolNum = True Then Exit For
Case "-", "/"
'ignore
Case Else
If boolNum = False Then
'no number char yet
tmp = tmp & ch
Else
Exit For
End If
End Select
Next
Else
tmp = vbNullString
End If
fGetFirstChars_Nums_w = tmp
Exit_fGetFirstCharsNums:
Exit Function
Err_fGetFirstCharsNums:
MsgBox Err.Description
Resume Exit_fGetFirstCharsNums
End Function