You're getting the error because you are setting the location for the same table. You need to set for both tables. Here is your modified code:
cReport = "d:\rpttest\testreport.rpt"
cTable1 = "d:\rpttest\client.dbf"
cName1 = "Client"
cTable2 = "d:\rpttest\station.dbf"
cName2 = "Station"
ocr = createobject("crystalruntime.application")
orpt = ocr.openreport(cReport)
odb = orpt.database
otables = odb.tables
otable = odb.tables.item(1)
otable.SetTableLocation(cTable1, cName1, "")
otable = odb.tables.item(2)
otable.SetTableLocation(cTable2, cName2, "")
orpt.discardsaveddata()
orpt.readrecords()
orpt.printout
>Craig,
>
>Thanks for the reponse. Not sure if I mentioned it, but I am
>using Crystal 9, Dev Edition. Not sure if it matters either.
>
>I Just ran the code you posted. I get the error:
>"OLE Dispath.. ActiveX Designer...The table 'Client' could not be found"
>
>I have zipped my sample stuff into a small zip file
here!>
>The prg is called SetLoc.prg. The contents of Temp1 are the
>original tables. Temp2 has the same tables renamed. I want to be able to
>point to either set in runtime.
>
>Would you try it please? Many Thanks
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer