Okay, this works, but there may be more elegant way of doing it:
Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As Integer)
Dim sSQL As String
Dim rs As ADODB.Recordset
Public sValue As String
sSQL = "SELECT Count(Product) As PCount FROM qryYourReportQuery"
Set rs = New ADODB.Recordset
rs.Open sSQL, CurrentProject.Connection, adOpenStatic, adLockReadOnly
sValue = rs("PCount")
Me.txtYourTextBox = sValue
rs.Close
End Sub
Now, I am not sure if the actual value in the text box will be available for your next formula, but the Public variable sValue WILL be. So try referring to the text box with something like:
=AVG([QtySold]/[txtYourTextBox])
And if that doesn't work, then do the calculation in code.
Did that help?
mmcdonal
|