How create report from subform?

gilberto

Registered User.
Local time
Today, 15:36
Joined
Apr 4, 2002
Messages
29
Hi All

I’m trying to create a report from a sub-form button for a scientific journal database. I have searched in the old topics, and they provided some solutions – but it still isn’t working. Any help is welcomed.

I have a form (Paper). For each record in Paper there is a subform (Referee New) with a list of referees of the paper.

I created a button for each referee in the subform Referee New. In the OnClick event of this button it should print preview a letter to this referee with details about that paper. The event has the following structure (PersonID is in the query’s Report):

DoCmd.OpenReport stDocName, acPreview, , "[PersonID]= forms![Referee New subform].[Paper]![RefereeID]"

What is happening in practice is that, when I press the button, two problems occur:
1)A window “Enter Parameter Value” appears, instead of an automatically generated report.
2)If I type the RefereeID number there, then the report is created with all the papers that this referee has refereed, instead of showing only that one described in the Paper report.

Thanks in advance for any help.
 
Hi Rich
Thank you very much for your help!
Following your advice (and some test-and-try)I changed the event:

stLinkCriteria = "[PersonID]=" & Me![RefereeID]
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria

Now the report is being automatically created. The only problem is that it shows all the papers refereed by the referee.
Do you know how can I solve this?
Many thanks and best wishes.
 
Hi Pat
Many thanks for your help, but I'm still having problems with the button.

I typed:
stLinkCriteria = "[PersonID]=" & Me![RefereeID] & "[PaperID]=" & Me![Paper_Record]
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria

When I click on it, the following message appears:
Syntax error (missing operator) in query expression '([PersonID]=559[PaperID]=1')
I guess the problem is with the "&" operator in the middle, but I can't find any information about the stCriteriaLink in the MVB (I'm sorry about my naivity).
Thanks in advance.
Gilberto
 
Use:
stLinkCriteria = "[PersonID]=" & Me![RefereeID] & " AND [PaperID]=" & Me![Paper_Record]
 
Hi David
Many thanks - it worked fine!
You guys (David, Pat, and Rich) can't imagine how helpful you were - I was struggling on that for almost one week.
Best wishes and thanks again!
Gilberto
 

Users who are viewing this thread

Back
Top Bottom