|
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 Object and assign it to the return value of this
method call. Here is an example:
Private Sub cmdDataEntry_Click()
Dim curDatabase As Object
Dim rstStudents As Object
Set curDatabase = CurrentDb
Set rstStudents = curDatabase.OpenRecordset("Students")
. . . Use the table as you see fit
Set rstStudents = Nothing
Set curDatabase = Nothing
End Sub