Missing calculated field in report

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MNNovice
    Contributor
    • Aug 2008
    • 418

    Missing calculated field in report

    I am trying to create a report that will keep remaining balance on each grant. But I am struggling with one little problem (for you gurus out there) all morning. Can someone please help?
    Here is the issue at hand:

    rptRunningBalan ce is based on qryExpDetail.
    qryExpDetail is based on tblExpDetail
    tblExpDetail has these fields (in addition to other): 1)ApAmount and 2)Amount
    qryExpDetail has NetAmount which is calculated as:
    [ApAmount]*qryGrantFunds. FedRatio

    rptRunningBalan ce has a ProjectNo Footer which keeps this info
    Budget
    TotalExp = Sum([NetAmount]) + Sum([Amount])
    Balance = Budget - TotalExp

    Well, if a project does not have an ApAmount I get blank data for Balance. For example, if Project A has a budget of $100 and an expense in ApAmount for $10 but no amount for "Amount" I get a blank balance instead of $90.

    I found out that when entering data I have disabled expense column based on category selected. For example if one selects AP then Amount column is no longer enabled. So if there is no data in Amount - my report just ignores the whole thing. When I manually entered a zero the report comes out fine. Here is the code I am referring:

    Code:
    Private Sub CategoryID_AfterUpdate()
        If Me.CategoryID.Value = 1 Then
            Me.ApAmount.Enabled = True
            Me.Type.Enabled = True
            Me.RefNo.Enabled = True
            Me.cboVendor.Enabled = True
            Me.txtEchoAmount.Enabled = True
            Me.Amount.Enabled = False
            Me.Type.SetFocus
    
      
        ElseIf Me.CategoryID.Value = 2 Then
            Me.ApAmount.Enabled = False
            Me.Type.Enabled = False
            Me.RefNo.Enabled = True
            Me.cboVendor.Enabled = False
            Me.txtEchoAmount.Enabled = False
            Me.Amount.Enabled = True
            Me.Date.SetFocus
      
        ElseIf Me.CategoryID.Value = 3 Then
            Me.ApAmount.Enabled = False
            Me.Type.Enabled = False
            Me.RefNo.Enabled = False
            Me.cboVendor.Enabled = False
            Me.txtEchoAmount.Enabled = False
            Me.Amount.Enabled = True
            Me.Date.SetFocus
        End If
    End Sub
    How can I fix this problem?


    Thanks.
  • ChipR
    Recognized Expert Top Contributor
    • Jul 2008
    • 1289

    #2
    For starters, add a field to your query defined as
    Nz([Amount], 0)
    and use that field for calculations instead of Amount.

    Comment

    Working...