Open Report Macro from subform with subreport

krowe

Registered User.
Local time
Today, 07:40
Joined
Mar 29, 2011
Messages
159
Please help,

I have a form called frmMain, containing a Subform called sformCasenotes. SubformCasenotes is a datasheet form with a button which I want to use to print the individual entry in the datasheet. The unique identifier on this subform is called CaseID. The field that binds these 2 forms is ID

The report I have set up is called rptCasenoteEntry, it is based on the table that frmMain is based on, and has contains a subreport called srptCasenotes. I have put the CaseID field in the header of the subreport (and made it not visible). The field that binds these reports is ID

I have set up the following macro to assign to the button to print the correct document:

OpenReport
Name: rptCasenoteEntry
View: Print Preview
Where:
[Reports]![rptCasenoteEntry]![srptCasenotes].[Report]![CaseID]=[Forms]![frmMain]![sformCasenotes].[Form]![CaseID]

Incidentally, I didn’t put [] around Reports and Form, Access seems to be doing that for me (I enter this: Reports![rptCasenoteEntry]![srptCasenotes].Report![CaseID]=Forms![frmMain]![sformCasenotes].Form![CaseID] in the box)

When I click the button I get a report with Error in the fields in the parent report and a no subreport.

Please can you advise what i'm doing wrong.

Thanks

Kev
 
Does this fix it???

[Reports]![rptCasenoteEntry]![srptCasenotes].[CaseID]=[Forms]![frmMain]![sformCasenotes].[CaseID]
 
Thanks for your quick reponse, I have just put that in and it comes up with an enter parameter value box for Reports!rptCasenoteEntry!srptCasenotes.CaseID

i put a value in and click ok, then it asks for the value for Forms!frmMain!sformCasenotes.CaseID

the report it gives then has every casenote entry for every person in the database

Any other ideas?
 
I know this might seem like a silly question but.. you never know.
If you go back to your original line that worked to open the report without prompts but caused "Error" to be displayed.
When you run that macro, is your form open?
 
Hi

Yes the form is open at the time, the button that calls the macro is on the sformCasenote form and the CaseID field is on there too but not visible.
 
Thanks for spending time to look at this, i attach a stripped out version of the DB. you will see in frmMain there is a button which says print full report, this one works fine, what i want to do is press the button in the casenotes subform and just print off the client details and the individual entry into the casenotes. Hope this explains it well enough.

Thanks again
 
Here ya go!
Hopefully this works the way you expected???
I was working on it kinda fast.
I left all your stuff and just added mine, so i'm sure you'll be able to see what I did, but if you need a further explination i'll gladly elaborate.

Basically, I created a new query, and filtered the results based on the form.
Then i created a new report that populated via that query.
(i'm not much for macros)
 

Attachments

Ok, i can see how you did that, and the report returns the correct casenote entry, however I need this report to be part of a bigger report, which also has the clients details.

So, I took your report and made it a sub report of a Rpt based on the tblPerson, however I now get all the records again :(

Do i need to filter both the client and the casenote entry, if so how would I do this?

Or could I add extra fields from the tblPerson to that query and then display the data that way???

Thanks again for all your help so far

Kev
 
ok, I added the tblPerson to the query, put the fields i needed in the report and its working.

thanks!!!
 
Hey Kev,
glad to hear you got that working. Congrats. Glad i was able to help you.
 

Users who are viewing this thread

Back
Top Bottom