Hi Rick;
let me try to explain each step the way to this query........now, let me also
say that the query works perfectly without the new columns only. in the
query design i have table MSM that has fields: ModelNumber, Desc, SpringID,
BorderID, ConfigID, SizeID, FoamCoreID, FoamEncID, BoxTypeID....etc.....the
other tables in the design of the query are Spring that's related to MSM by
SpringID, Border related to MSM by BorderID AND SO ON. essentially, the query
will be displaying
example.
ModelNumber| Desc |Spring, |Border, |Config, |Size, |FoamCore,
|FoamEnc
m1001 some desc sp10 b11 single 33 f345
fe101
Concatinate stuff is the adding of items in the same line.
this is created because the user selects of the same item multiple times on a
form and i used the following module to do this.
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 , adLockOptimistic
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
Rick said:
no criteria applied .....here is my SQL....the new added colums are
FoamCore, FoamEnc, BoxType, BoxProfile.......and i dont seem to know
[quoted text clipped - 22 lines]
BoxType.BoxTypeID = MSM.BoxtypeID
WITH OWNERACCESS OPTION;
The syntax you are using...
FoamCore.FoamCore, FoamEnc.FoanEnc, BoxType.BoxType, BoxProfile.BoxProfile
...is one that implies TableName.FieldName. You can't just make these up
and add them to a query. What purpose do you want them to serve?
Also what is Concatenate("SELECT ...")? I see no reference to any such
function in Access help. Is that a user-defined function?