'How do I assign a value to an unbound textbox when opening report in VBA?

I am using Access 2013 and have a report that I am trying to set the values of eight unbound textboxes when it gets opened. In the code I have written so far, I have opened a recordset and used it to calculate the value of eight items. This part of code works fine. Now I want to get these eight values into the report where they will be used in a calculation.

The first unbound textbox name in the report is "CivPistonUnder"

Here is the code:

Dim strDocName As String
Dim lngPistonUnder As Long

strDocName = "rptAWMP"
DoCmd.OpenReport strDocName, acViewPreview, , , acWindowNormal
'this is where I want to set the value of the unbound textbox
'I have tried
Me.CivPistonUnder = lngPistonUnder
'I get a compilation error: Method or data member not found
'I tried
Set CivPistonUnder = lngPistonUnder
'I get Compile error: Object required
'I tried
Set Report.rptAWMP!CivPistonUnder = lngPistonUnder
'I get Object Required

Is there a way to pass this info to the report?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source