* ADOControl.init && Write correct testdata path #Define TESTDATALOC C:\ddrive\TEMP\testdata.DBC strCn = [Provider=MSDataShape.1;Persist Security Info=False;]+; [Data Source="Data Provider = MSDASQL;]+; [DSN=Visual FoxPro Database;UID=;SourceDB=TESTDATALOC;]+; [SourceType=DBC;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;Null=Yes;]+; [Deleted=Yes;";Data Provider=MSDASQL ] strShp = [SHAPE { select customer.cust_id, Company, ]+; [ orders.order_id, order_date, order_net, shipped_on, ]+; [ line_no, prod_name ] +; [ from customer ]+; [ left outer join orders ]+ ; [ on customer.cust_id = orders.cust_id ] +; [ inner join orditems ]+ ; [ on orditems.order_id = orders.order_id ] +; [ inner join products ]+ ; [ on orditems.product_id = products.product_id } ] With this .CommandType = 1 .ConnectionString = strCn .RecordSource = strShp Endwith * Commandbutton.click With Thisform.OleGrid .Datasource = Thisform.ADOControl.Recordset .RowDividerStyle = 4 .Headlines = 4 For ix = 0 to .Columns.Count-1 With .Columns(ix) .Caption = .Caption + " Other lines of header" .DividerStyle = 4 Endwith Endfor .Caption = "Invoices" EndwithPls note that SHAPE command is not a hierarchical one. If you write a hierarchical one you can use MSFlexGrid to get a nice hierarchical (treeview like) grid too ;) For your convenience below is a hierarchcal version :
strShp = [SHAPE { select cust_id , Company from customer } ]+ ; [ APPEND (( SHAPE { select cust_id, order_id, order_date, order_net, shipped_on from orders } ]+; [ APPEND ( { select order_id, line_no, prod_name from orditems inner join products on products.product_id = orditems.product_id } ]+; [ AS rsOrditems RELATE order_id TO order_id )) ] +; [ AS rsOrders RELATE cust_id TO cust_id ) ]Cetin