Results 1 to 3 of 3

adding a column from mulitple listboxes, and putting the total into a textbox

  1. #1
    Suttoa is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2019
    Posts
    1

    adding a column from mulitple listboxes, and putting the total into a textbox

    Hello,



    I am having trouble with a spot of VBA, that should be easy..

    I have a Form with a lot of list boxes (32) each has queries calculating different fields but their columns line up. I am hoping to sum up column(7) of each listbox, and entering the total into a textbox on the same form


    I have tried using various scripts to pull the list box value (it is a double.. more specifically currency), as an example I was going to use this:

    With lstbox
    MsgBox (.Column(6))
    tbTotalRRPREM = .Column(6)
    End With


    in troubleshooting the above message box states the value is null, but the lstbox is definitely not null..

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    6,021
    My guess is that you're not aware that the column property of a listbox or combo is 0 based, thus column(6) is the 7th column. What's missing from your post is how many columns are in each control.
    - "doesn't work" is no help. Post err msgs and where.
    - Use code tags for code/sql. Implement changes in copies of your database.
    Sometimes I talk to myself - like when I need expert advice.

  3. #3
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    7,603
    can you set each listbox to be bound on col(6) (remember : col 7 in form view, col 6 in vb)

    then just sum all the listboxs
    lstBox1 + lstbox2 + lstbox3...

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 10-17-2018, 04:51 AM
  2. Replies: 35
    Last Post: 03-19-2018, 12:06 AM
  3. Replies: 3
    Last Post: 09-23-2017, 08:16 AM
  4. Replies: 4
    Last Post: 05-22-2015, 05:52 AM
  5. Adding mulitple records from same form
    By mikehorse in forum Forms
    Replies: 5
    Last Post: 09-22-2014, 06:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Tech Forums: Microsoft Office Forums