Opening a Record Object Referencing an Open Recordset Object - Opening a Recordset by Providing an URL (Page 2 of 4 )
Create a form RstRecord in your MDB application. This MDB database has no tables; we are just using the Form objects. Add a button, and to the click event of the command button, paste this code. It shows how easy it is to open a recordset object providing an URL.
Private Sub Command0_Click()
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
'rst.Open "", "URL=http://hodentek/"
rst.Open "Hodentek", "URL=http://hodentek/"
MsgBox ("Recordset is open:" & rst.State)
rst.Close
MsgBox ("Recordset is closed:" & rst.State)
End Sub
You may be wondering, what about the provider information needed to open the recordset object? If the IIS (Web Server) is correctly installed, this provider is automatically used. Add the following code after the rst.open but before the rst is set to a nothing statement.
Private Sub Command0_Click()
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
rst.Open "", "URL=http://hodentek/"
Text1.SetFocus
Text1.Text = rst.ActiveConnection
Text3.SetFocus
Text3.Text = rst.Source
Text5.SetFocus
Text5.Text = rst.CursorType
rst.Close
Set rst = Nothing
End Sub
When the form is open and the button is clicked the following details are displayed. The other form’s format details are: Text1 control’s Scroll Bars property is set to Vertical and the Can Grow property is set to “Yes.”

You may be wondering what the fields collection consists of. The first item is AccXML.htm - an alphabetically sorted HTM file, followed by ‘http://hodentek’ and ‘http://hodentek/AccXML.htm’.
Next: Opening the Record Object after Opening the Recordset Object >>
More Database Articles
More By Jayaram Krishnaswamy