TESTDATALOC = _samples+"data\testdata.DBC" PUBLIC oForm oForm = createobject('myForm') oForm.Show Define CLASS myform AS form Top = 0 Left = 0 Height = 450 Width = 750 DoCreate = .T. Caption = "Form1" Name = "Form1" Add OBJECT hflex AS olecontrol WITH ; Top = 0, ; Left = 0, ; Height = 420, ; Width = 750, ; Name = "Hflex", ; OleClass = 'MSHierarchicalFlexGridLib.MSHFlexGrid' Procedure Init Local oRecordset,oConnection, strCn, strShp strCn = [Provider=MSDataShape;Persist Security Info=False;]+; [Data Source=]+TESTDATALOC+[;Data Provider=VFPOLEDB] *!* strShp = [SHAPE TABLE customer ]+; *!* [ APPEND ( (SHAPE TABLE orders ]+; *!* [ APPEND (TABLE orditems RELATE order_id TO order_id)) ]+; *!* [ RELATE cust_id TO cust_id ) ] strShp = [SHAPE {select Company,Cust_id from customer} as Customers ]+; [ APPEND ( {select cust_id,order_date,order_id from orders} RELATE cust_id TO cust_id ) ] oRecordset = CreateObject("adodb.recordset") oConnection = CreateObject("adodb.connection") With oConnection .Provider = "MSDataShape" .ConnectionString = strCn .Open Endwith With oRecordset .ActiveConnection = oConnection .Source = strShp .Open Endwith With this.hflex .Datasource = oRecordset .GridColorBand(0) = rgb(255,0,0) .GridColorBand(1) = rgb(0,0,255) .Cols(0) = 2 .ColWidth(0,0) = 16*15 .ColWidth(1,0) = 250*15 .CollapseAll * .BandDisplay = 1 Endwith Endproc EnddefineCetin