How long does recordset stay open?

Giganews Newsgroups
Subject: How long does recordset stay open?
Posted by:  Jim M (manda…
Date: 25 Aug 2006

I rarely deal with recordsets directly with code, since I usually use
Access queries, so be patient with this question. I want to open a
recordset with various default variables used by my program. I tried:

Public Sub OpenDefaults()
    Dim db As dao.Database
    Dim globalRst As dao.Recordset
        Set db = CurrentDb()
        Set globalRst = db.OpenRecordset("tblDefaults")
End Sub

I am able to pull variable I need when I'm IN this module. e.g.

boolUseFormA = globalRst!bFrmA

Whoever, I am not able to get the variables after executing the module.
I thought the recordset stayed open until I did: 'Set globalRst =
nothing'. I wanted to open the recordset when I started up my
application, then put variables from it as needed.

My questions are:
1) Am I doing something wrong? Should I be able to pull data from the
recordset until I reset it to nothing?
2) If this is impossible, which would be best for performance:
          a) Opening a form with the variables and pulling them from
the form, e.g.
                          boolUseFormA = Forms!globalForm!bFrmA
          b) Running the above code with the additional line to pull
the data I need and also additional codes to unset the database and
recordset objects?

Jim M