Solved

How sum totals i na listbox on a form

Posted on 2014-01-16
6
604 Views
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?
0
Comment
Question by:SteveL13
  • 3
  • 2
6 Comments
 
LVL 27

Expert Comment

by:MacroShadow
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.
0
 

Author Comment

by:SteveL13
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.
0
 
LVL 27

Expert Comment

by:MacroShadow
ID: 39787020
Is the form that contains the txtTotalQty field open at the time of adding the records?
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

Author Comment

by:SteveL13
ID: 39787217
Yes.
0
 
LVL 27

Expert Comment

by:MacroShadow
ID: 39787249
Try Me.Repaint
0
 
LVL 74

Accepted Solution

by:
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
        Forms!Form1!lstQTY.Requery
    End If
End Sub


This works fine for me:
Database51.mdb
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
bind Combobox 4 29
Auto Filter in Combo Box 7 31
Update fields from multiple tables via same form 2 23
Query design issue 2 21
This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
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…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

911 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now