To declare global Record and Recordset objects
Option Explicit Dim grec As Record Dim grs As Recordset
This code declares global object references for Record and Recordset objects that will be used later in this scenario.
To connect to a URL and populate lstMain
Private Sub Form_Load() Set grec = New Record Set grs = New Recordset grec.Open "", "URL=http://servername/foldername/", , _ adOpenIfExists Or adCreateCollection Set grs = grec.GetChildren While Not grs.EOF lstMain.AddItem grs(0) grs.MoveNext Wend End Sub
This code instantiates the global Record and Recordset objects. The Record, grec
, is opened with a URL specified as the ActiveConnection. If the URL exists, it is opened; if it does not already exist, it is created. Note that you should replace "http://servername/foldername/" with a valid URL from your environment.
The Recordset, grs
, is opened on the children of the Record, grec
. Then lstMain is populated with the file names of the resources published to the URL.
Step 3: Populate the Fields List Box