Calculated fields in acNormal report remain blank

WorkingVBA

Registered User.
Local time
Today, 02:50
Joined
Jul 3, 2013
Messages
33
Hi,

I have a report with a number of calculated fields, and information that is pulled from the form that calls the report. Pulling the information is done in the Report_Load() event by setting the report.txtBox = Form.txtBox. When I open the report in acPreview all the calculated fields are populated as they should, and when I open the report in acNormal mode (which is what I want) the calculated fields remain blank. Any ideas why?

Thanks
 
Is the form still open? You can only reference open forms.
 
Thanks Pat for your reply,

Yes the form is still open. Like I said it works when the report is opened in acPreview mode but it doesn't work when it is opened in acNormal mode which sends the report directly to the printer.
 
Pulling the information is done in the Report_Load() event by setting the report.txtBox = Form.txtBox.
The correct syntax is:
=Forms!FormName!ControlName
 
The correct syntax is:
=Forms!FormName!ControlName

Sorry, I was using short hand :o the actual code is:

Code:
    Dim vFormObj As Form
    Set vFormObj = Forms![frmRebalMaster]![frmRebalSubReportObj].Form
    ' Get values from the Calculator form and assign them to
    ' corresponding textboxes in the report
    txtPortfolioTotal = vFormObj!txtPortfolioTotal
    txtIM_Account = vFormObj!txtIM_Account
    'txtModel = vFormObj!txtIM_Account
    txtPercentEquity = vFormObj!txtPercentEquity
    txtPercentFixedInc = vFormObj!txtPercentFixedInc
    ' Capture the model name using the percent equity
    txtModel = DLookup("ModelName", "lstModels", "lstModels.PctEquity =" & txtPercentEquity)
    txtMultiCap = vFormObj!txtMultiCap
    txtRealEstate = vFormObj!txtRealEstate
    txtPreciousMetals = vFormObj!txtPreciousMetals
    txtBalanced = vFormObj!txtBalanced
    txtStableValue = vFormObj!txtStableValue
    txtTaxExempt = vFormObj!txtTaxExempt
    txtFixedAnnuity = vFormObj!txtFixedAnnuity
    txtCertDeposit = vFormObj!txtCertDeposit
    txtCash = vFormObj!txtCash
    txtMoneyMarket = vFormObj!txtMoneyMarket

Still that would (should) not matter. If the code was wrong it would have bombed in both acPreview and acNormal mode.
 
Open the report in design view and, for each control, type the second part of yours expressions (after the equal sign) as control source (in the Property Sheet).

Example:
For the txtPortfolioTotal control the Control Source will be
= vFormObj!txtPortfolioTotal (including the equal sign)
 
Thanks,

That took care of it. Any idea why the report was behaving this way?
 

Users who are viewing this thread

Back
Top Bottom