I am almost there.
Here is what I did to get the results of my recordset into my form.
Function ListMH() As String
'Declare a variable to hold the comma separated values
Dim strCSVals As String
Dim fld As DAO.Field
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("tblWONodes", dbOpenDynaset)
Set fld = rst("[NodeID]"
Do Until rst.EOF
strCSVals = strCSVals & fld & ", "
rst.MoveNext
Loop
Set rst = Nothing
'After the loop has ended you can trim up strVals like so:
strCSVals = Left(strCSVals, Len(strCSVals) - 2) 'This will remove the last character (space and comma) from the string
ListMH = strCSVals
End Function
Report txtListNodes Control Source = ListMH()
The problem is the tblWONodes I want to actually be a more select group of records from qryWONodes.
SELECT * FROM tblWONodes WHERE (((tblWONodes.WorkOrderNo)=[Forms]![frmWO]![WorkOrderNo]))ORDER BY tblWONodes.NodeID;
This works great if I just run the query. It only returns the results from the WorkOrderNo displayed on frmWO, but when I put it in CurrentDb.OpenRecordset("qryWONodes" I get a rst = Nothing Error.
Any ideas on what I am doing wrong. When I take the parameter out it works fine in the function.