Running a VB6 sql query and need to do something kind of crazy.
So I am running the following SQL query SELECT username FROM MFUSERS WHERE USERNAME IN('test1', 'test2','test3')
I need it to create a string based off of what it has found.
So if it returns two rows and those two rows have TEST1 and TEST2 in them I need to concat to a string.
So for each record that it returns I would need it to build me a string as below example
So delimited by comma
My Code Currentky
Dim finalvalue As String
Dim database As New ADODB.Connection
Dim records As New ADODB.Recordset
Dim sql As String
Dim phones As String
database.ConnectionString="Provider=sqloledb; Data Source=192.168.2.121\EMMSDE;Initial Catalog=outlookreport; User Id=jsmith; Password=s5993153492;"
sql = "SELECT * FROM OUTLOOKREPORT.DBO.MFUSERS WHERE USERNAME IN('" & AccountVariable("scriptrecip") & "'"
records.Open , sql, database, adLockReadOnly
For Each fld In records.Fields
finalvalue = finalvalue & records.Fields(0)