How sum totals i na listbox on a form

Posted on 2014-01-16
Last Modified: 2014-01-18
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?
Question by:SteveL13
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 27

Expert Comment

ID: 39786450
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.

Author Comment

ID: 39786466
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.
LVL 27

Expert Comment

ID: 39787020
Is the form that contains the txtTotalQty field open at the time of adding the records?
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 39787217
LVL 27

Expert Comment

ID: 39787249
Try Me.Repaint
LVL 74

Accepted Solution

Jeffrey Coachman earned 500 total points
ID: 39787649
Then Requery the listbox on Form1 when Form2 closes

Private Sub Form_Close()
    If CurrentProject.AllForms("form1").IsLoaded Then
    End If
End Sub

This works fine for me:

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question