I have a form with about 10 recordsets. Of them 7 are named rstTemp_1, rstTemp_2 on to rstTemp_7. They are temporary RowSources for listboxes in the form.
In using the form, one, two up to all of the listboxes may have data placed in them. I am looking for a method to loop through all the open recordsets for a match to the string "rstTemp_" so that I can then check it for data and if present, manipulate it.
I've run across two MS Access97 Help examples but in my class module, Access gives me an error and I can understand because in the examples the recordset are dimensioned but not set. The Access code snippet is like this:
Dim dbs As Database, rst As Recordset
For Each rst In dbs.Recordsets
Debug.Print rst.Name; " "; rst.Updatable
Next rst
My test code is as follows:
Dim rstLoop As Recordset
For Each rstLoop In dbs.Recordsets
If Left(rstLoop.name, 8) = "rst_Temp" Then
Debug.Print rstLoop.name
End If
Next rstLoop
Interestingly, I don't get an error, the FOR statement is executed and the entire IF statement is jumped.
I welcome any advice offered.
Regards, Sorrells
In using the form, one, two up to all of the listboxes may have data placed in them. I am looking for a method to loop through all the open recordsets for a match to the string "rstTemp_" so that I can then check it for data and if present, manipulate it.
I've run across two MS Access97 Help examples but in my class module, Access gives me an error and I can understand because in the examples the recordset are dimensioned but not set. The Access code snippet is like this:
Dim dbs As Database, rst As Recordset
For Each rst In dbs.Recordsets
Debug.Print rst.Name; " "; rst.Updatable
Next rst
My test code is as follows:
Dim rstLoop As Recordset
For Each rstLoop In dbs.Recordsets
If Left(rstLoop.name, 8) = "rst_Temp" Then
Debug.Print rstLoop.name
End If
Next rstLoop
Interestingly, I don't get an error, the FOR statement is executed and the entire IF statement is jumped.
I welcome any advice offered.
Regards, Sorrells