Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 136,573 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,924 people online right now. Registration is fast and FREE... Join Now!




Counting the no. of records displayed in the listview

 
Reply to this topicStart new topic

Counting the no. of records displayed in the listview

emkaye
13 May, 2008 - 11:19 PM
Post #1

D.I.C Head
**

Joined: 12 Aug, 2007
Posts: 54


My Contributions
i would like to count the no. of records displayed in my list view. please help me with the codes. Below is my code i've already started for listview:

CODE


TallyInput = InputBox("Enter search below. It could be either by repat no or by any type of field you wish to search.")

TallyResult = "select * from tblRepat where GENDER = '" & optF.Caption & "' AND CIRCUMSTANCES = '" & TallyInput & "' OR GENDER = '" & optF.Caption & "' AND OCCUPATION = '" & TallyInput & "' OR ACTION_TAKEN = '" & TallyInput & "' OR LAST_NAME = '" & TallyInput & "' "
Set TallyRS = myConn.Execute(TallyResult)

    If TallyRS.EOF = True Then
MsgBox "Record does not exist!"
   lvRes.ListItems.Clear
    Else

    MsgBox "Record found!"
    
     lvRes.ListItems.Clear
    Do Until TallyRS.EOF
   Set LS = lvRes.ListItems.Add(, , TallyRS(0))
  
    LS.SubItems(1) = TallyRS(1) & ""
    LS.SubItems(2) = TallyRS(2) & ""
    LS.SubItems(3) = TallyRS(3) & ""
    LS.SubItems(4) = TallyRS(4) & ""
    LS.SubItems(5) = TallyRS(6) & ""
    LS.SubItems(6) = TallyRS(7) & ""
    LS.SubItems(7) = TallyRS(8) & ""
    LS.SubItems(8) = TallyRS(9) & ""
    LS.SubItems(9) = TallyRS(10) & ""
    LS.SubItems(10) = TallyRS(11) & ""
    LS.SubItems(11) = TallyRS(13) & ""
    LS.SubItems(12) = TallyRS(14) & ""
  LS.SubItems(13) = TallyRS(15) & ""
  
    
    TallyRS.MoveNext
    Loop
    End If



PLEASE HELP.

TNX,,,
User is offlineProfile CardPM
+Quote Post

emkaye
RE: Counting The No. Of Records Displayed In The Listview
14 May, 2008 - 12:02 AM
Post #2

D.I.C Head
**

Joined: 12 Aug, 2007
Posts: 54


My Contributions
is this code right?

CODE

CountInput = "SELECT Count(*) AS count FROM tblRepat WHERE GENDER= '" & optM.Caption & "' AND OCCUPATION = '" & TallyInput & "'"

Set CountRS = myConn.Open(CountInput)
Label1.Caption = CountRS.Fields("Count").Value



pls help...
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/3/08 12:00AM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month