How sum totals i na listbox on a form

On a form I have a listbox.  The values in the listbox come from a table named tblBayQuantities.  In that table is a numeric field named "Qty"

On the form itself I want a field named txtTotalQty to sum the qty values in tblBayQuantities.

But it doesn't update the total qty when the form I'm using to enter data into the listbox is closed.

What am I doing wrong?
SteveL13Asked:
Who is Participating?
 
Jeffrey CoachmanConnect With a Mentor MIS LiasonCommented:
Then Requery the listbox on Form1 when Form2 closes

Private Sub Form_Close()
    If CurrentProject.AllForms("form1").IsLoaded Then
        Forms!Form1!lstQTY.Requery
    End If
End Sub


This works fine for me:
Database51.mdb
0
 
MacroShadowCommented:
But it doesn't update the total qty when the form I'm using to enter data into the listbox is closed.

I'm confused, you input data in the listbox?

Please attach a sample.
0
 
SteveL13Author Commented:
No.. I input data in a 2nd form which when closed populates the listbox on form 1.  But the tot qty field on form 1 doesn't update when a record has been added or changed in the listbox via the 2nd form.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
MacroShadowCommented:
Is the form that contains the txtTotalQty field open at the time of adding the records?
0
 
SteveL13Author Commented:
Yes.
0
 
MacroShadowCommented:
Try Me.Repaint
0
All Courses

From novice to tech pro — start learning today.