Article ID: 147882
Article Last Modified on 7/1/2004
dbOpenTable to open a table-type Recordset object.
dbOpenDynaset to open a dynaset-type Recordset object.
dbOpenSnapshot to open a snapshot-type Recordset object.
When you open a database using the data control, a Recordset object is
automatically created based on the control's RecordSource property. You
can address this Recordset with the following syntax:
Data1.Recordset
Dim MyRecordset As Recordset Set MyRecordset = Data1.Recordset
Set Data1.Recordset = MyRecordset
Default Property Value of Property ------------------------------------------------- Command1 Caption Assign Table-type Command2 Caption Assign Dynaset-type Command3 Caption Assign Snapshot-type Data1 DatabaseName BIBLIO.MDB Data1 RecordSource Titles Text1 DataSource Data1 Text1 Datafield Title Text2 DataSource Data1 Text2 Datafield Year Published
Private Sub Command1_Click()
Dim ws As Workspace
Dim db As Database
Dim tbl As Recordset
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase("Biblio.mdb")
Set tbl = db.OpenRecordset("titles", dbOpenTable)
Set Data1.Recordset = tbl
End Sub
Private Sub Command2_Click()
Dim ws As Workspace
Dim db As Database
Dim rs As Recordset
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase("Biblio.mdb")
Dim StrSQL As String
StrSQL = "Select * from titles where title like 'a*' "
Set rs = db.OpenRecordset(StrSQL, dbOpenDynaset)
Set Data1.Recordset = rs
End Sub
Private Sub Command3_Click()
Dim ws As Workspace
Dim db As Database
Dim sn As Recordset
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase("Biblio.mdb")
Dim StrSQL As String
StrSQL = "Select * from titles where title like 'the*' "
Set sn = db.OpenRecordset(StrSQL, dbOpenSnapshot)
Set Data1.Recordset = sn
End Sub
Additional query words: kbVBp400 kbVBp600 kbVBp500 kbdse kbDSupport kbVBp kbRDO
Keywords: kbhowto KB147882