Appending records to a recordset with a for loop

Joined
Nov 9, 2005
Messages
17
Reaction score
0
I have a listbox, where the user can select as many records as he wants to. for each record that he selects, i need to pull information out of the database and append it to a recordset that i will be displaying in my worksheet. i have the connectivity to my database all worked out, but for some reason i cannot append to my recordset.

any ideas?

thanks so much in advance!
Code:
If groupingType = "FName" Then For i = 0 To lstNames.ListCount - 1 If lstWells.Selected(i) Then sqlCmd = "SELECT * " & _ " FROM MasterTable INNER JOIN ChildTable ON MasterTable.MID = ChildTable.CID " & _ " WHERE ChildTable.CName = '" & lstNames.List(i) & "' AND ChildTable.Father = 'John Smith'" Debug.Print sqlCmd Set rs = CurrentDb.OpenRecordset(sqlCmd, dbOpenDynaset, dbAppendOnly) End If Next i(this goes on for a while if grouping type = various different things)​


So the debug.print does infact print that the right information is being selected. but the rs does not do anything. (in debug mode, it just skips right over that line)
thanks again
 
Back
Top