Reputation: 37
I have a report that has a Subreport. The Subreport references an ID that will populate the subreport. I keep getting an Enter Parameter Value
error. If I put in the correct ID in the box and click ok the report populates correctly. So my assumption is that I have not referenced the ID correctly, but I can not figure out what I am doing incorrectly.
The report will work in the form until I insert it in to another form. I have a Navigation form called Main
, a subform named ProductsList
, and a subform inside of ProductsList
called SupplierDS
. The control name is ID
. This is the reference I have:
[ID]=Forms![Main]![ProductsList].Form![SupplierDS].Form![ID]
Is this the correct reference to access the control ID?
This is the VBA code that I am using to reference the ID:
Private Sub Command524_Click()
Dim stDocName As String
stDocName = "SupplierDS"
DoCmd.OpenReport stDocName, acViewPreview, , "[ID]=Forms![Main]![ProductsList].Form![SupplierDS].Form![ID]"
End Sub
Upvotes: 1
Views: 408
Reputation: 32642
You can use string concatenation to make the statement work independent of where the form is:
DoCmd.OpenReport stDocName, acViewPreview, , "[ID] = " & Me!ID
Upvotes: 0