Hello,
I am trying to fix a problem on a database that I didn't create. I need help with some code on a combo box filter. I have form "frmEstimatedPayment". On this form a have an Unbound combo box that filters the "Agents" to give me a total of estimated payments by each quarter. I have 5 text boxes running a sum on the same form for(Quarters: 1,2,3,4 and YTD) for each agent.
When the form is loaded/opened it shows all agents and the textboxes show an #Error message. However, if I select one single agent each textbox gives me the correct payment amount per quarter.
Here is some of the current code:
In the Unbound combo box:
Private Sub ComboAgent_AfterUpdate()
Me.Filter = "(([Bonus Payout by Month].[Name]='" & Me.ComboAgent & "'))"
Me.FilterOn = True
Me.Recalc
End Sub
Also in the unbound combo box click envent:
Private Sub ComboAgent_Click()
Me.FilterOn = True
End Sub
Here is the code in the 5 Textboxes:
=Sum([Bonus Payout by Month]![Q107])
=Sum([Bonus Payout by Month]![Q207])
=Sum([Bonus Payout by Month]![Q307])
=Sum([Bonus Payout by Month]![Q407])
=Sum([Bonus Payout by Month]![EE Bonus])
How can I make the textboxes totals sum all agents when there is no specific agent name selected?
Do I need to place some code on the "frmEstimatedPayment" form? Can someone help me?
Thanks.
I am trying to fix a problem on a database that I didn't create. I need help with some code on a combo box filter. I have form "frmEstimatedPayment". On this form a have an Unbound combo box that filters the "Agents" to give me a total of estimated payments by each quarter. I have 5 text boxes running a sum on the same form for(Quarters: 1,2,3,4 and YTD) for each agent.
When the form is loaded/opened it shows all agents and the textboxes show an #Error message. However, if I select one single agent each textbox gives me the correct payment amount per quarter.
Here is some of the current code:
In the Unbound combo box:
Private Sub ComboAgent_AfterUpdate()
Me.Filter = "(([Bonus Payout by Month].[Name]='" & Me.ComboAgent & "'))"
Me.FilterOn = True
Me.Recalc
End Sub
Also in the unbound combo box click envent:
Private Sub ComboAgent_Click()
Me.FilterOn = True
End Sub
Here is the code in the 5 Textboxes:
=Sum([Bonus Payout by Month]![Q107])
=Sum([Bonus Payout by Month]![Q207])
=Sum([Bonus Payout by Month]![Q307])
=Sum([Bonus Payout by Month]![Q407])
=Sum([Bonus Payout by Month]![EE Bonus])
How can I make the textboxes totals sum all agents when there is no specific agent name selected?
Do I need to place some code on the "frmEstimatedPayment" form? Can someone help me?
Thanks.