Okay, that's me speed reading: I was expecting a subform question rather
than a subreport. The reference should be to
Me!SubFormControl.Report.Recordsource
On the other hand, if you've already got that right, I am not quite sure
that the problem is. Can you post the code you are actually using, and
point out exactly which line causes the error?
Me.mdate.Report.RecordSource = "SELECT
tblJobDetails.Partner, tblJobDetails.[M DATE ON Going
Research]FROM tblJobDetails WHERE (((tblJobDetails.[M
DATE ON Going Research]) Between #" & StartDate & "# And
#" & EndDate & "#)) ORDER BY tblJobDetails.Partner;"
mdate is the subreport. Startdate and enddate are two
varibles it asks for when starting up but I have tried
just a simple SQL code but it still brings up the same
error. The error highlights this line and says
"you have entered an expresion that has an invalid
reference to the property Form/Report"
Also i have tried putting the code into mdate itself but
it has an error saying you cant change sourcecode when
printing has started.
Me.mdate.Report.RecordSource = "SELECT
tblJobDetails.Partner, tblJobDetails.[M DATE ON Going
Research]FROM tblJobDetails WHERE (((tblJobDetails.[M
DATE ON Going Research]) Between #" & StartDate & "# And
#" & EndDate & "#)) ORDER BY tblJobDetails.Partner;"
Is this in the OnFormat event or something? I am not surprised that Access
is complaining if you are altering the recordsources on the fly like that.
My instinct would be to get the basic query right before opening the report
(that is what joins are for, after all) and not mess about.
If there is some reason why you need an exceptionally complex approach,
then you may be better off in the m.p.a.reports group.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.