Printable Version of Topic

Click here to view this topic in its original format

UtterAccess Forums _ Access Forms _ Sum For List Boxes

Posted by: Aakburns May 21 2020, 10:46 AM

I have this form setup to total each day of the week hours into decimal hours automatically. However I need to total those hours for each day together. I have a decimal total field, I've tried this as a text box with an expression and as a query using another list box. They work but I have to select each Dec box total for it to show the added math in the Decimal Total.

Is there an easier way to do this? I need it to simply sum all Dec. boxes together without any other interaction.

Each Dec. total box is a list box, so that I could set the boxes for times to requery each when updated the times are updated or entered..


I've tried this as an expression.

QUOTE
=[Monday_Dec]+[Tuesday_Dec]+[Wednesday_Dec]+[Thursday_Dec]+[Friday_Dec]+[Saturda
y_Dec]+[Sunday_Dec]


and

QUOTE
=Sum([Monday_Dec]+[Tuesday_Dec]+[Wednesday_Dec]+[Thursday_Dec]+[Friday_Dec]+[Sat
urday_Dec]+[Sunday_Dec])


Also, as a query as

QUOTE
Decimal_Total: [Monday_Dec]+[Tuesday_Dec]+[Wednesday_Dec]+[Thursday_Dec]+[Friday_Dec]+[Saturday
_Dec]+[Sunday_Dec]


 

Posted by: nuclear_nick May 21 2020, 10:59 AM

How is the rest of the form filled out? is the data being entered or just presented with the form? Are these...

QUOTE
=Sum([Monday_Dec]+[Tuesday_Dec]+[Wednesday_Dec]+[Thursday_Dec]+[Friday_Dec]+[Sat
urday_Dec]+[Sunday_Dec])

meaning the "Monday_Dec" etc.. fields in the query AND the names of text boxes on the form?

Posted by: Larry Larsen May 21 2020, 02:10 PM

Hi
Just an idea.. could you use the "Tag" property of each listbox control and then total as you loop through each control..
thumbup.gif

Posted by: RJD May 21 2020, 02:39 PM

Hi: I don't think we have the complete information we need here. Could you post a db with relevant objects, no sensitive data, zipped? That way I think a solution could be forthcoming quickly.

HTH
Joe

Posted by: Aakburns May 21 2020, 04:19 PM

This shows, the Label names. I just need to add up these list boxes based on the first row into to show in the Decimal Total, which is a qry that says to add them. However it actually works currently, but I have to click each Dec. box for it to show the total right now.

 

Posted by: RJD May 21 2020, 04:30 PM

Hi: I think without having the db (or a copy with relevant objects and example data) we are just guessing in the dark and probably will not be able to help you except by chance. Could you, as I requested before, post a db (not an image, but an actual attached zipped accdb) for us to work with? You are using some terms that are throwing us off (such as "Label" when you should be working with textbox controls, or "list boxes" where they might not actually be Access ListBoxes at all). The db will clarify all that for us. Thanks.

Looking forward to seeing your db and assisting ...

HTH
Joe

Posted by: projecttoday May 21 2020, 05:04 PM

What kind of form is it? (Continuous?) If you don't want to post the database post the table layout.

Posted by: June7 May 21 2020, 05:59 PM

Those look like textboxes, not listboxes.

Data structure is not normalized and that is true root of issue.