Private Sub Command1_Click() Dim V As Variant Dim i As Integer Dim j As Integer Dim DB As Long Dim FileLength As Long Dim DBFile As String Dim ErrorString As String Dim ReturnCode As Integer Dim QueryString As String On Error GoTo Error DBFile = "Albums.db" ' Use the demo albums (make sure it is in same folder) DB = 0 QueryString = "SELECT t1.ArtistName,CDs.Title,CDs.date " & _ "FROM Artists t1, CDs " & _ "Where t1.ArtistID = CDs.ArtistID " & _ "ORDER BY ArtistName,CDs.Date DESC " ' Check for presence of the required database file ' SQLite will create a file if one doesn't exist! sqlite3_open DBFile, DB If DB > 0 Then WriteLn "Calling sqlite_get_table() ..." WriteLn "Querying: " & QueryString V = sqlite_get_table(DB, QueryString, ErrorString, ReturnCode) WriteLn "Query complete ..." If Not IsEmpty(V) Then WriteLn "Table has " & Format$(UBound(V) - LBound(V) + 1) & " column(s)" WriteLn "Table Variant is of type " & TypeName(V) WriteLn "Table has " & Format$(GetArrayDimensions(V)) & " dimensions - (should be 2)" WriteLn "Table has " & Format$(GetArrayRows(V)) & " row(s) (+1 higher than rowcount)" WriteLn "Query returned " & Format$(sqlite_query_rowcount()) & " row(s) (excluding header row)" WriteLn String$(200, "-") If GetArrayRows(V) > 1 Then 'Address and use the data For i = 0 To GetArrayRows(V) - 1 For j = LBound(V) To UBound(V) Writes V(j, i) & String$(2, 9) Next WriteLn If i = 0 Then WriteLn String$(200, "-") ' If header row Next WriteLn String$(200, "-") End If Else WriteLn "No rows returned - make sure " & DBFile & " is in the same directory" End If Else WriteLn "Failed to open " & DBFile & " make sure it is in the same directory" End If Exit Sub Error: Text1.Text = "Error " & Format$(Err.Number) & " (" & Err.Description & ")" Resume Next End Sub Public Sub WriteLn(Optional Str = "") ' Avoids the messy code below Text1.Text = Text1.Text & Str & vbCrLf End Sub Public Sub Writes(Optional Str = "") ' Avoids the messy code below Text1.Text = Text1.Text & Str End Sub