ocr = createobject("crystalruntime.application") orpt = ocr.openreport("c:\cr\myreport.rpt") odb = orpt.database otables = odb.tables otable = odb.tables.item(1) otable.SetTableLocation("C:\temp\goober.dbf", "goober", "") orpt.discardsaveddata() orpt.readrecords() orpt.printout()>Craig,
>FUNCTION SetTableLocations >PARAMETERS aTables > >oTables = ._oReport.Database.Tables > >** Loop once for each array element >FOR nTable1 = 1 TO ALEN(aTables, 1) > > ** Extract the table name and alias from the array > cTable = aTables[nTable1, 1] > cAlias = LOWER(ALLTRIM(aTables[nTable1, 2])) > > ** Loop once for each table in the collection > FOR nTable2 = 1 TO oTables.Count > > ** Extract the table from the collection, and get the alias name > oTable = oTables.Item(nTable2) > cRptAlias = LOWER(ALLTRIM(oTable.Name)) > > ** If the report alias matches the array alias... > IF cRptAlias = cAlias > ** Change the data location > oTable.Location = cTable > ENDIF > > ENDFOR > > ENDFOR > >>
>oRpt = ._oReport >oDB = oRpt.Database >ocDBT = oDB.Tables() > >oDBT = ocDBT.Item(1) >oDBT.Location = aTables[1, 1] > >oDBT = ocDBT.Item(2) >oDBT.Location = aTables[2, 1] >>