Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 22nd, 2008, 11:49 AM
Authorized User
 
Join Date: Nov 2007
Location: Nederland, , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default record count help

Greetings,
I've got to do a count of all the records in a search.
Right now I've used an array to get the results but how can I also get a count of the records found. Example: if I search for the records that contain the REV letter "A" and I get a return showing 24 records, I want to have a msgbox the shows the number of records found is 24.
Here is my search code:
Private Sub TogFilter_Click()
    Dim strFilt(0 To 10) As String
    Dim aryIdx As Integer
    Dim FiltStr As String

    If TogFilter.Value = -1 Then
        If cboDwgNo.Value <> "" Then strFilt(0) = "[DwgNo] = '" & cboDwgNo.Value & "'"
        If cboLineNo.Value <> "" Then strFilt(1) = "[LineNo] = '" & cboLineNo.Value & "'"
        If cboDwgType.Value <> "" Then strFilt(2) = "[DwgType] = '" & cboDwgType.Value & "'"
        If cboPIDNo.Value <> "" Then strFilt(3) = "[PIDNo] = '" & cboPIDNo.Value & "'"
        If cboPipeSpec.Value <> "" Then strFilt(4) = "[PipeSpec] = '" & cboPipeSpec.Value & "'"
        If cboProjNo.Value <> "" Then strFilt(5) = "[ProjNo] = '" & cboProjNo.Value & "'"
        If cboRev.Value <> "" Then strFilt(6) = "[Rev] = '" & cboRev.Value & "'"
        If cboModule.Value <> "" Then strFilt(7) = "[Module] = '" & cboModule.Value & "'"
        If cboArea.Value <> "" Then strFilt(9) = "[Area] = '" & cboArea.Value & "'"
        If cboStress.Value <> "" Then strFilt(9) = "[StressRel] = '" & cboStress.Value & "'"
        If cboTracing.Value <> "" Then strFilt(10) = "[tracing] = '" & cboTracing.Value & "'"

        For aryIdx = LBound(strFilt) To UBound(strFilt)
            If strFilt(aryIdx) <> "" Then
                If FiltStr <> "" Then
                    FiltStr = FiltStr & " and " & strFilt(aryIdx)
                Else
                    FiltStr = strFilt(aryIdx)
                End If
            End If
        Next aryIdx
    End If

    If FiltStr = "" Then FiltStr = "[DwgNo] <> ''"
    FiltStr = "(" & FiltStr & ")"
    Me.Filter = FiltStr
    DoCmd.ApplyFilter , FiltStr
    Me.Refresh
End Sub

Thanks

Reply With Quote
  #2 (permalink)  
Old January 22nd, 2008, 12:46 PM
Authorized User
 
Join Date: Nov 2007
Location: Nederland, , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have an Idea, I have 2 buttons for select and deselect all after I've filtered for the records. They use ADO or DAO recordset. I could use the recordcount method inside those options to return the number.

Reply With Quote
  #3 (permalink)  
Old January 22nd, 2008, 02:49 PM
Authorized User
 
Join Date: Nov 2007
Location: Nederland, , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Nevermind on the idea, Because the count would only work when the select buttons is clicked. I need it to work when filtered.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
count no of record sanjeev jha ADO.NET 1 November 5th, 2007 12:28 PM
Record count deb1980 ASP.NET 2.0 Basics 6 April 10th, 2007 12:42 PM
Count Record prasanta2expert Access 3 November 28th, 2006 10:42 AM
How to count a record when it is not there Mitch Access 1 October 3rd, 2003 03:49 PM



All times are GMT -4. The time now is 04:51 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.