Solved

How sum totals i na listbox on a form

Posted on 2014-01-16
6
608 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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 

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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Access Crosstab Query with Multiple Values 4 32
Need to Populate a MS Access Table via VBA Code 3 30
Access Update Query 1 20
DCount Type Mismatch 2 22
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
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…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

773 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