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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print Report for Current Record Displayed in subform

Status
Not open for further replies.

capndave

Technical User
Mar 4, 2003
36
US
How do I reference current TissueID displayed in subform in the following:

Private Sub PrintImplRec_Click()
On Error GoTo Err_PrintImplRec_Click

Dim stDocName As String

stDocName = "ImplantRecord"
DoCmd.OpenReport stDocName, acPreview, , "[TissueID]=Forms!EDITORDERRECEIPT!TissueID"


where "EDITORDERRECEIPT" is the parent and "Receipt_Child_form" is the subform. The TissueID is found only on the subform.

Thanks
 
Hi!

Try this:

DoCmd.OpenReport stDocName, acPreview, , "[TissueID]= " & Forms!EDITORDERRECEIPT!YourSubformControlName.Form!TissueID

Note, this will work if TissueID is numerical. If it is alphanumeric use:

DoCmd.OpenReport stDocName, acPreview, , "[TissueID]= '" & Forms!EDITORDERRECEIPT!YourSubformControlName.Form!TissueID & "'"

hth

Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
What is the name of the subform control? Hint: not necessarily the same as the name of the subform itself.

[TissueID]=Me!SubformControlName.Form!TissueID

Ken S.
 
Oops, jebry is right, I forgot to concatenate...

"[TissueID]=" & Me!SubformControlName.Form!TissueID

Ken S.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top