|
Opening a table is equivalent to opening a record set.
Therefore, to open a table in the Microsoft Access Object Library, call the
OpenRecordset() method of the Database class. This method can
take as argument the name of the table on which you want to perform data
entry. Based on this, here is an example of calling the method:
|
Private Sub cmdDataEntry_Click()
curDatabase.OpenRecordset("Students")
End Sub
Once you have the record set, you can use it as you
see fit. To support this, the OpenRecordset() method returns an
object named Recordset. If you want to use the table after opening
the record set, get the return value of the method. To do this, declare a
variable of type DAO.Recordset and assign it to the return value of
this method call. Here is an example:
Private Sub cmdDataEntry_Click()
Dim curDatabase As DAO.Database
Dim rstemployees As DAO.Recordset
Set curDatabase = CurrentDb
Set rstemployees = curDatabase.OpenRecordset("Employees")
. . . Use the table here
Set rstemployees = Nothing
Set curDatabase = Nothing
End Sub