Hi Robeen;
I am very happy to see a helpful person. Thanks a lot.
I am exactly mining the Google for one week. Find lots of example codes for this situation. By the way, as you said, "It seems almost the opposite of how a database is supposed to be used." you are right. But it is very hard to convince a damn manager!!! 
So, Your code that gave me, I tried but I got some errors. Then, I asked a guy in Turkish forums for a code. He applied this code to my sample database called CARS. ( It is attached ). It is working peoperly. The SQL statement is embeded in the textbox with this:
Code:
=Concatenate("Select KOD FROM Arabalar Where Yas = 8 ")
But if you change the table name, It doesn't work.
And VBA code this:
Code:
Option Compare Database
Function Concatenate(pstrSQL As String, _
Optional pstrDelim As String = ", ") _
As String
'Created by Duane Hookom, 2003
'this code may be included in any application/mdb providing
' this statement is left intact
'example
'tblFamily with FamID as numeric primary key
'tblFamMem with FamID, FirstName, DOB,...
'return a comma separated list of FirstNames
'for a FamID
' John, Mary, Susan
'in a Query
'SELECT FamID,
'Concatenate("SELECT FirstName FROM tblFamMem
' WHERE FamID =" & [FamID]) as FirstNames
'FROM tblFamily
'
'======For DAO uncomment next 4 lines=======
'====== comment out ADO below =======
'Dim db As DAO.Database
'Dim rs As DAO.Recordset
'Set db = CurrentDb
'Set rs = db.OpenRecordset(pstrSQL)
'======For ADO uncomment next two lines=====
'====== comment out DAO above ======
Dim rs As New ADODB.Recordset
rs.Open pstrSQL, CurrentProject.Connection, adOpenKeyset, adLockReadOnly
Dim strConcat As String 'build return string
With rs
If Not .EOF Then
.MoveFirst
Do While Not .EOF
strConcat = strConcat & _
.Fields(0) & pstrDelim
.MoveNext
Loop
End If
.Close
End With
Set rs = Nothing
'====== uncomment next line for DAO ========
'Set db = Nothing
If Len(strConcat) > 0 Then
strConcat = Left(strConcat, _
Len(strConcat) - Len(pstrDelim))
End If
Concatenate = strConcat
End Function
By the way, in the attached file, the table name is "arabalar" which means in Turkish "cars". And the field "yas" means age. ( a quick turkish lesson if you wish
)
thanks, Robeen, additional to this I am looking to Allen Browne's page that you advised me. Thanks a lot.
Why this code stops working if we change the name of table ? Do you have an idea ??