TESTDATALOC = _samples+"data\testdata.DBC" oForm = Createobject('myForm') oForm.Show Read Events 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 LoadSet Local oRecordset,oConnection, strCn, strShp 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 ] oRecordset = Createobject("adodb.recordset") oConnection = Createobject("adodb.connection") With oConnection .Provider = "MSDataShape" .ConnectionString = strCn .Open Endwith strShp = [SHAPE TABLE customer ]+; [ Append ( (Shape Table orders ]+; [ Append (Table orditems Relate order_id To order_id)) ]+; [ Relate cust_id To cust_id ) ] With oRecordset .ActiveConnection = oConnection .Source = strShp .Open Endwith With This.hflex .Datasource = oRecordset .Mergecells = 3 .GridColorBand(1) = Rgb(255,0,0) .GridColorBand(2) = Rgb(0,0,255) .GridColorBand(3) = Rgb(0,255,0) .ColWidth(0,0) = 300 .CollapseAll Endwith Endproc Procedure Init With This .hflex.Height = .Height .hflex.Width = .Width .LoadSet() Endwith Endproc Procedure QueryUnload Clear Events Endproc EnddefineCetin