Hi Guys and Girls.
I just have a quick question. My VBA knowledge is ok, however I am not very good at programming with SQL.
I have a piece of code which works fine. It is just that it is not robust, I have created a loop with an string and open an recordset at the end of my loop I close the record set and in the beginning I open this again.
I think it could work faster and I hope you guys can help me with some other solutions.
here is my code
Thanks
I just have a quick question. My VBA knowledge is ok, however I am not very good at programming with SQL.
I have a piece of code which works fine. It is just that it is not robust, I have created a loop with an string and open an recordset at the end of my loop I close the record set and in the beginning I open this again.
I think it could work faster and I hope you guys can help me with some other solutions.
here is my code
Code:
c = 37
Do Until Cells(c, 2).Value = Empty
TeamMember = Cells(c, 2).Value
r = 36
For i = 4 To 34
Days = Cells(r, i).Value
strSQL = "SELECT [" & TeamMember & "] From [Planning$] Where [Days]=" & "#" & Format(Days, "mm/dd/yyyy") & "#" & ""
rs.Open strSQL, DBConnection, adOpenDynamic, adLockOptimistic
Cells(c, i).Offset(0, 0).CopyFromRecordset rs
rs.Close
Next i
c = c + 1
Loop
Thanks