1
votes

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

1
Where exactly did you place that code? It seems correct, but it's not clear to me what you're doing with it.Erik A
I have placed a print button on the SupplierDS Sheet. This is part of a Do.Cmd in VBA.C.G.
Then share that. You can likely fix this by modifying that statementErik A

1 Answers

0
votes

You can use string concatenation to make the statement work independent of where the form is:

DoCmd.OpenReport stDocName, acViewPreview, , "[ID] = " & Me!ID