Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

report with sub-report activated from form

Status
Not open for further replies.

uscitizen

Technical User
Jan 17, 2003
672
US
I have a form called “Trtmnts_Admnstrd” whose purpose is to let the user identify the record in the database (s)he wants to appear in a report called: “Treatment Administered”. On this form are three unbound combo box type controls and two command type buttons.

The combo boxes consist of two numeric controls (called “Patient Number” and “Cycle”. The third control is text (“Medication”).

The two buttons serve to “Print” a report and to let the user “Close” this form. We shall be focusing on the first one.

The “Print” button has a macro attached to the ‘On click’ event property that activates a report called “Treatment Administered”. “Treatment Adminstered” consists of a parent report and a correlated (child) sub-report called “Treatment and Toxicity” and “Protocol Medications”, respectively, and the linking fields (as I call them) in each are “Patient Number” and “Cycle” in the child and “Patient Number” and “Cycle Number” in the master. “Medication”, which is defined by the user on the third unbound control is on the sub-report which we said is called “Protocol Medications”. [I don't know whether this is important or not, nevertheless, the report is a condensed version of a form/sub-form combination which was 'Saved as' a 'Report' and from which controls were dropped leaving the report/sub-report "Treatment and Toxicity"]

The “Where condition” of the “Open Report” action of the macro that the clicking action launches is:

[Cycle]=[Forms]![Trtmnts_Admnstrd]![Cycle] And [Patient Number]=[Forms]![Trtmnts_Admnstrd]![Patient Number] And [Forms]![Treatment and Toxicity]![Protocol Medications].[Form]![Medication]=[Forms]![Trtmnts_Admnstrd]![Medication]

The point of this posting is to tell you that when I click “Print” on the “Trtmnts_Admnstrd” form, you’re prompted to provide a couple of parameters. If I ignore both of them, a report having empty controls is generated.

Suffice it to say this has me scratching my head as I 'know' these ‘prompts’ suggest that the data aren’t getting passed along. I can not undestand this.
 
Try your where condition like this:

"[Cycle]= " &
[Forms]![Trtmnts_Admnstrd]![Cycle] &
" And [Patient Number]= " &
[Forms]![Trtmnts_Admnstrd]![Patient Number]

The where condition needs to be a string expression, so you have to enclose your text in "text here" and use &'s to concatenate in the variables on your form.

This part of your original where condition:

And [Forms]![Treatment and Toxicity]![Protocol Medications].[Form]![Medication]=[Forms]![Trtmnts_Admnstrd]![Medication]

I'm not sure what you are trying to do with it. You are setting a form field = to another form field.

Judging what else you said, maybe you can set your unbound control on the subreport to have the Control Source be =[Forms]![Trtmnts_Admnstrd]![Medication]
 
hi --

adding the quotes and the ampersands managed to confuse ms a2k and reward me with a message about being unable to parse the expression. remember this text is entered in the macro design area (where perhaps quotes and ampersands wont work).

regarding the part of the phrase you weren't clear as to the purpose of.....

my thinking went something like this:

a) since the records which went into making the sub-report can appear more than once for some combination of 'Patient Number' and 'Cycle', i.e. there can be more than one 'Medication' that the 'Patient Number' was taking during the 'Cycle' and

b) since i need to filter on just one 'Medication' per combination of 'Patient Number' and 'Cycle' and

c) since 'Medication' which the user designates on 'Trtmnts_Admnstrd' needs to synch up with the one in the records underlying the sub-report and

d) since the sub-report is dependent upon the sub-form in the phrase that that was the syntax to use.

since i've not done this before, i wouldn't be all that amazed if i haven't gotten on ms a2k's wrong side.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top