Local cnStr, cCrit, cSql >*-- create the connection with the shape provider >This.oH = CreateObject("ADODB.Recordset") >This.oCn = CreateObject("ADODB.Connection") >cnStr = "Provider=MSDataShape.1;Data Provider=SQLOLEDB.1;" >cnStr = CnStr + "Integrated Security=SSPI;Initial Catalog=myDatabase;" >cnStr = CnStr + "Data Source=myServer" >With This.oCn > .CursorLocation = 3 > .ConnectionString = cnStr > .Open >EndWith > > >cCrit = "GXV13800" > >cSql = "SHAPE {Select Filename, field2 From myTable " >cSql = cSql + "Where Filename Like '" + cCrit + "%'} " >cSql = cSql + "As QReport APPEND ({Select field1, field2 From QR_Detail} " >cSql = cSql + "As QDetail Relate FileName To cSql = cSql + "FileName) As QDetail" >This.oH = This.oCn.Execute(cSql) >This.oH.ActiveConnection = Null >This.oCn.Close >This.HFGrid1.DataSource = This.oH>Where HFGrid1 is the ole control that contains the MSHFlexGrid control.HTH