Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004
    Posts
    2

    Unanswered: How Do I Print a Record From a Subform?

    I'm building a Db in Access 2K, where I have a a "Buildings" form with a "Residents" subform in it. I've created a print command button on the "Buildings" form to try to print the currently selected record from the "Residents" subform. I'm using this code to do it:

    Dim strReportName As String
    Dim strCriteria As String
    strReportName = "rptPrintRecord"
    strCriteria = "[BldgName]='" & Me![BldgName] & "'"
    DoCmd.OpenReport strReportName, acViewPreview, , strCriteria


    "BldgName" is the name of the parent form. Clicking the print button will open the "rptPrintRecord" report in preview mode, of course, but will only have the current record from the parent form. I know I need to make a reference to the subform in the code to have it print the current record in it, but I'm not sure how to do that, being a Db newbie. I know it's got to be something simple, but darned if I can figure it out. Any help would be greatly appreciated.

  2. #2
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634
    try
    Form![MainformName]![SubformName]![ControlName]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •