LISTING 1: Visual Basic Program that Uses Drillthrough Dim oConn As Connection Dim rs As Recordset ' Establish an OLAP connection to the FoodMart 2000 database Set oConn = New Connection oConn.Open "Data Source=LocalHost;Provider=MSOLAP;Initial Catalog=FoodMart 2000" Set rs = New Recordset ' perform the drill through operation but return a maximum of 3 rows rs.Open "DRILLTHROUGH MAXROWS 3 " & _ " SELECT { [Time].&[1997].&[Q1].&[1] } ON COLUMNS , " & _ " { [Customers].[State Province].&[CA].&[Altadena] } ON ROWS " & _ " FROM [Sales]", oConn Dim nField As Integer Dim sDesc As String ' loop through the returned rows and output the field names and values While Not rs.EOF sDesc = "" For nField = 0 To rs.Fields.Count - 1 sDesc = sDesc & rs.Fields(nField).Name & "=" & rs.Fields(nField).Value & " " Next nField Debug.Print sDesc rs.MoveNext Wend ' cleanup Set rs = Nothing oConn.Close Set oConn = Nothing