I want to open a recordset ordered in one way and process it, and then open it ordered differently and process it in another way.
Should I set it to nothing after each opening?
Should I include the first "Set rst = Nothing" in the following code?
I think I should do this. Just want to check.
Code:
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String
Set dbs = CurrentDb
strSQL = "SELECT Task, Priority, TheDate FROM tTasks ORDER BY TheDate"
Set rst = dbs.OpenRecordset(strSQL, dbOpenDynaset)
' Process the recordset
rst.Close
Set rst = Nothing ' ****** Do I need this statement
strSQL = "SELECT Task, Priority, TheDate FROM tTasks ORDER BY Priority"
Set rst = dbs.OpenRecordset(strSQL, dbOpenDynaset)
' Process the recordset
rst.Close
Set rst = Nothing