#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 Company, cust_id from customer } ]+; [APPEND (( SHAPE { select distinct First_name, Last_name, a.emp_id + cust_id as "Emp_sel", cust_id from employee a inner join orders b on a.emp_id = b.emp_id } ]+; [APPEND (( SHAPE { select order_date, order_net, shipped_on, emp_id + cust_id as "Emp_sel",order_id 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 rsCustomers ]+; [RELATE emp_sel TO emp_sel )) AS rsOrders ]+; [RELATE cust_id TO cust_id ) ] with this .CommandType = 1 .ConnectionString = strCn .RecordSource = strShp endwithCetin