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

Opening a report based on a subform

Status
Not open for further replies.

mjake13

Programmer
Aug 26, 2001
28
US
I am trying to open a report based on a subform, but I keep getting a parameter value box when the value is already on the subform. Any help would be appreciated!!

Here's the code so far:

Dim stDocName As String

stDocName = "rptBookingReportOLD"
DoCmd.OpenReport stDocName, acPreview, , "[Record No]=forms![subNameMugshot3]![Record No]"

[subNameMughot3] is a subform, the main form is called Incidents. The command button to preview the report is on the subform.


"Ordinary people make extraordinary leaders"
 
I believe there is a specific way to qualify the name of a subform in code. This is probably where your missing it. The form '[Forms]![<formname>]' is for main forms. If you are trying to refer to a subform I think you have to use '[Forms]![<main formname>].Form![<subform name>]' This may not be exact but it will give you a place to start looking. I couldn't look it up myself because my help files are acting up on me. Hope this gives you a place to start.
 
Actually got it to work with this coding:

stDocName = &quot;rptBookingReportOLD&quot;
DoCmd.OpenReport stDocName, acPreview, , &quot;[Record No]=&quot; & Me![Record No]

Thanks for the help though
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top