Hi Eric,
The subreport also has to log into the database using LogonInfo.
Usually I have a function for logging onto the database. This way I can pass the report or subreport object to it and not have to duplicate the code. I don't know if that's possible in PowerShell.
So now that you have opened the subreport, you can have it log onto the database same as the main report, the only difference is you just need to use $sub instead of $report.
foreach ($Table in $sub.Database.Tables)
{
$table
$tli = $Table.LogonInfo
$li = $tli.ConnectionInfo
Write-host "location : $($table.location)"
$li.ServerName = "myserver"
$li.DatabaseName = "mydatabase"
$li.UserID = "user"
$li.Password = "password"
$Table.ApplyLogOnInfo($tli)
$table.location
}
If you have more than 1 subreport you'll need to do it for each subreport. Going back to c#, I have an array that contains all the subreports. Then I loop through each of the subreports, logging them on individually and doing any other manipulation.
Good luck,
Brian