Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 644
  • Last Modified:

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?
0
SteveL13
Asked:
SteveL13
  • 3
  • 2
1 Solution
 
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
 
MacroShadowCommented:
Is the form that contains the txtTotalQty field open at the time of adding the records?
0
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

 
SteveL13Author Commented:
Yes.
0
 
MacroShadowCommented:
Try Me.Repaint
0
 
Jeffrey CoachmanMIS 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now