Hello,
I am quite new to both Microsoft Access and VBA. I am using Access 2007.
I have been asked to write some simple VBA code to be used inside an existing
.mdb database. I will be using DAO.
My question is very simple. If I want to open a recordset, is the following code
sufficient?
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("tblStudents")
Or, do I first need to explicitly open the database using the "OpenDatabase" method?
I would think that the database is already open when I launch the application,
so I don't know why I would need to open it. On the other hand, I see many VBA code examples
that use the "OpenDatabase" method.
Thank you!
I am quite new to both Microsoft Access and VBA. I am using Access 2007.
I have been asked to write some simple VBA code to be used inside an existing
.mdb database. I will be using DAO.
My question is very simple. If I want to open a recordset, is the following code
sufficient?
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("tblStudents")
Or, do I first need to explicitly open the database using the "OpenDatabase" method?
I would think that the database is already open when I launch the application,
so I don't know why I would need to open it. On the other hand, I see many VBA code examples
that use the "OpenDatabase" method.
Thank you!