I am working with Access 2007. I am trying to print a report from the current record on a Subform. My form is comprised of a Main form with a sub-form and another sub-form with in the sub-form.
Main form = Renters Info
Subform = Rental Info
Subform = Dates for rental
I want to print off a report for one rental that lists the info for the rental with the renter information. I have created a button on the Rental subform to print the report. I have tried various codes that I have found on the internet to connect the current record to the report, however it does not work. I keep getting a pop-up box that asks me to “Enter Parameter Value” for the FuntionID. If I enter the right ID it works(wrong Id I get an error), but I don’t want to have to enter the ID as it should just print the current record without asking?
Here are the three codes I have been working with. All with the same result.
I am not sure what I am doing wrong but think it is probably something to do with the printing for a subform? Any Ideas?
Thanks
Main form = Renters Info
Subform = Rental Info
Subform = Dates for rental
I want to print off a report for one rental that lists the info for the rental with the renter information. I have created a button on the Rental subform to print the report. I have tried various codes that I have found on the internet to connect the current record to the report, however it does not work. I keep getting a pop-up box that asks me to “Enter Parameter Value” for the FuntionID. If I enter the right ID it works(wrong Id I get an error), but I don’t want to have to enter the ID as it should just print the current record without asking?
Here are the three codes I have been working with. All with the same result.
Code:
Dim strDocName As String Dim strWhere As String strDocName = "Contract" strWhere = "[FunctionID]=" & Me!FunctionID DoCmd.OpenReport strDocName, acPreview, , strWhere End Sub Dim strReportName As String Dim strCriteria As String strReportName = "Contract" strCriteria = "[FunctionID]=" & Me![FunctionID] & "" DoCmd.OpenReport strReportName, acViewPreview, , strCriteria End Sub Dim Condition As String Condition = "[FunctionID]=[Forms]![Main]![SubFunctionForm].[Form]![FunctionID])" DoCmd.OpenReport "Contract", acViewPreview, , Condition End Sub
Thanks
Comment