Hi there, I've got a problem when setting the recordsource of a subreport using vba. I am getting an error message "The expression you entered refers to an object that is closed or does not exist".

The process I am going through (in code) is:

1) open the report in design mode
2) set the recordsource for 1st sub report (no problem)
3) set the recordsource for the 2nd subreport (error)

The problem seems to be because I have two instances of the same subreport within the report - ie the sourceobject is the same for each one. I can set the recordsource for one OK but the other gives the message above.

I suppose I could save two copies of the same report but I have a big report to do with LOTS of subreports in all doubling up.

Is this a bug or is there a way around it programmatically? I have done the same with forms and subforms and it has been fine.

Many thanks for reading this.