Ok, im using vb.net and a DGV to open a access DB. On load im filtering out everything except what was created on the current date.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'Database1DataSet.Table1' table. You can move, or remove it, as needed.
        Me.Table1TableAdapter.Fill(Me.Database1DataSet.Table1)
        AddNew.Close()
        Dim filterString As String
        Dim myView As DataView = New DataView()
        myView.Table = Database1DataSet.Table1
        filterString = ""
        If filterString = "" Then
            filterString = "[Date Time] LIKE '%" & DateTimePicker1.Value.Date & "%'"
        Else
            filterString = filterString & " AND [Date Time] like '%" & DateTimePicker1.Value.Date & "%'"

        End If
        myView.RowFilter = filterString
        DataGridView1.DataSource = myView

    End Sub

what im trying to do is count the number of "c""b""v""o""m" that are in the column name "Status" the problem is it counts the number of those characters in the whole DB not what was visible in the DGV. How do i count only what was left after the filter? i dont know much about SQL commands but someone meantioned using a WHERE query to load only the data i needed but i dont know where to start witht that

someone meantioned using a WHERE query

Yes, that's correct. Modify your filter (after adding the datetime filter)

filterString = filterString & " AND ([Status] like 'c' OR [Status] like 'b' OR [Status] like 'v' OR [Status] like 'o' OR [Status] like 'm')"

HTH

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.