Not sure if I have understood things correctly,
but till another option comes along, check out below for guidelines ( based on table structures in my previous post ) :
The source for the function ( as far as I can see, should work without any problem. There is another one in the same thread below the function - check it out also)
http://www.pcreview.co.uk/forums/spl...-t1172256.html
Save below function :
Code:
Public Function fNthElement(KeyString As Variant, Delimiter As String, ByVal ElementNo As Integer) As Variant
Dim arrSegments As Variant
If Len(Trim(KeyString & "")) > 0 Then
arrSegments = Split(KeyString, Delimiter, -1, vbTextCompare)
If ((ElementNo - 1) <= UBound(arrSegments)) And (ElementNo > 0) Then
fNthElement = arrSegments(ElementNo - 1)
Else
fNthElement = Null
End If
Else
fNthElement = Null
End If
End Function
Save the below first subquery :
qrySplitTheNumbers
Code:
SELECT
tblNumbers.ID,
tblNumbers.TheNumbers,
Int(fNthElement([TheNumbers],",",1)) AS TheFirstNumber,
Int(fNthElement([TheNumbers],",",2)) AS TheSecondNumber,
Int(fNthElement([TheNumbers],",",3)) AS TheThirdNumber,
Int(fNthElement([TheNumbers],",",4)) AS TheFourthNumber
FROM
tblNumbers;
Save the below second subquery :
qryGetAllTheNumbers
Code:
SELECT ID, TheFirstNumber as TheNumber FROM qrySplitTheNumbers WHERE TheFirstNumber is not null
UNION
SELECT ID, TheSecondNumber as TheNumber FROM qrySplitTheNumbers WHERE TheSecondNumber is not null
UNION
SELECT ID, TheThirdNumber as TheNumber FROM qrySplitTheNumbers WHERE TheThirdNumber is not null
UNION
SELECT ID, TheFourthNumber as TheNumber FROM qrySplitTheNumbers WHERE TheFourthNumber is not null;
The final query to run :
qryGetTheNumberNames
Code:
SELECT
qryGetAllTheNumbers.ID,
qryGetAllTheNumbers.TheNumber,
tblNumberNames.TheNumber_1,
tblNumberNames.TheName
FROM
qryGetAllTheNumbers
INNER JOIN
tblNumberNames
ON
qryGetAllTheNumbers.TheNumber = tblNumberNames.TheNumber_1;
Note :
1) Another option could be, doing a "Text To Columns" in the Excel itself & then importing it to Access table (this would eliminate the use of split function query)
2) For all that I know, there might be a much much easier way.
Thanks