I am coding up someting that shoudl be simple. I am sure my code has an issue.
My code is below. THe issue I am having is that during the For i=0 there is an issue when inserting into the database it does not insert anything it just leaves it blank. My databasde value should be a string.
My goal is to have it run a query for each string that is in the array and use that string that it is currently on in the query.
Public pdffile As ADODB.Stream
Const delimiter As String = ","
Dim i As Integer
Dim iterStr As String
Dim mainlist As String
Dim sublist As String
Dim split_sublist() As String
Dim pdfpath, pdfpath1 As String
Dim sql As String
Dim database As New ADODB.Connection
Dim rs As ADODB.Recordset
mainlist = AccountVariable("xrefidlist")
sublist = AccountVariable("xrefidlist")
split_sublist = Split(sublist, delimiter)
For i = 0 To UBound(split_sublist)
database.ConnectionString = "Provider=sqloledb; Data Source=192.168.2.121\EMMSDE;Initial Catalog=outlookreport; User Id=xxxxx; Password=xxxxx;"
sql = "SELECT * FROM comlog"
Set rs = New ADODB.Recordset
rs.Open " select * from comlog", database, adOpenKeyset, adLockOptimistic
Set pdffile = New ADODB.Stream
pdffile.Type = adTypeBinary
rs.Fields("location") = pdffile.Read
rs.Fields("xrefid") = split_sublist(i)
rs.Fields("sender") = "Testing VB6"
rs.Fields("status") = "Unread"
rs.Fields("fromemail") = "email@example.com"
Set pdffile = Nothing
Set rs = Nothing
'clean mainlist the way you want.
mainlist = Trim(mainlist)
totaloutput = Left(mainlist, Len(mainlist) -1)
AccountVariable("recievers") = totaloutput