Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listbox, get total of certain data

Status
Not open for further replies.

niteraven

Technical User
Oct 26, 2006
92
US
Hello All

I have a listbox that I am trying to get the total $$ for a week from. I can total all of the records that appear in the listbox fine but when I total based on the week number it goes thru the code, and gets to IF statement and then even when the IF statement is true it skips over it.

Here is the code:

Code:
   Dim listsum As Double
   Dim x As Integer
   
   With Me.lstsummary
    .Requery
    For x = 0 To .ListCount
       If Me.nowWk.Value = .Column(10, x) Then
       
        listsum = listsum + Nz(.Column(12, x), 0)
       
       End If
    End With
    Me.txttotweek.Value = listsum

I have changed code around, I trade "Me" for forms!frmname!nowWk. When I was using the debugger I saw that the nowWk was 47, but that column 10 was "47". In the query that is used to fill the listbox, is using datepart("ww",[datename]) as column 10 so wouldn't that result be a numeric result not text?

any help would be appreciated.
Raven

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top