Dazzy
09-25-2010, 08:36 AM
Hey All
Let me explain what I am trying to do, I want to change the source object of a sub report control depending on the value contained within another field on the report, is this possible?
I tried
If Me.[fieldname].Value = "string" Then
Me.MainSubRpt.SourceObject = "Report name"
End if
But access spouts an error saying the "string" text value is empty
Do reports require different syntax?
Thanks
DCrake
09-25-2010, 09:27 AM
You do not need the .Value syntax
Dazzy
09-25-2010, 09:49 AM
Thanks for the reply but I already tried without .Value and it had the same error
moaning about expression with no value
Thanks again
vbaInet
09-25-2010, 10:08 AM
I don't think you can set the SourceObject property of a subreport in code whilst in Preview mode. So what you're trying to do will fail anyway.
Why not use a DLookup() instead?
Dazzy
09-26-2010, 08:08 AM
Thanks will take a look and see how I get one
vbaInet
09-26-2010, 08:24 AM
It might also be worth creating a query that combines records from both the record sources of the subreport and the main report. Then you can use Groupings to group the relevant fields based on an ID. Investigate that option too.
Dazzy
09-26-2010, 11:30 AM
Cheers
Had another thought just there, the report is launched from the form, what if the button on the form was set to load a different version of the report depending on the value in one field. Is that possible?
Simon_MT
09-26-2010, 12:24 PM
Dazzy,
Congratulations, you worked it out for yourself.
I rarely use SubReports as you have groupings and you can put the 'parent' information in the Grouping section and the subreport information can be put in the Rport Details. Bye-Bye SubReports!
Simon
vbaInet
09-26-2010, 12:43 PM
Cheers
Had another thought just there, the report is launched from the form, what if the button on the form was set to load a different version of the report depending on the value in one field. Is that possible?What you initially mentioned was a dynamic change of the source object of the subreport based on the value of a field on the report for each record. What you've just mentioned is going a different direction.
I'm now thinking that what you are trying to achieve is filtering the report based on a value on your form. Could you explain the situation with the subreport?
Like Simon, I too don't like subreports but they have their place.
Dazzy
09-27-2010, 10:22 PM
Hi
Thanks for all your help, reports and me don't really get on and I am trying to bolt a mechanism on to the database to track which students belonged to which order no.
So the sub report was going to pull in the student reg info onto the order purchase note, but exploring it more I seen a problem, not all our courses are handled in the same way, it some have unit registration, while other is full qualification registration.
When I originally designed the database I never had this requirement in mind, it's just a very picky auditor wanted to see this information and is causing me a headache, but thanks to you guys help I can see the light, have it working for full qualification registrations, and now have to take a slightly different approach for the unit based registration ones.
Another thing that just cropped up yesterday was the need for remote access to the database off site, I am not too sure about Access security with regards to web modules so I might just stick with a simpler solution of deploying a remote pc control utility such as logMeIn.
Thanks again
vbaInet
09-28-2010, 12:32 AM
Another thing that just cropped up yesterday was the need for remote access to the database off site, I am not too sure about Access security with regards to web modules so I might just stick with a simpler solution of deploying a remote pc control utility such as logMeIn.Yeap, a VPN should do. Or sharepoint server.
Good luck!