1 Replies - 2175 Views - Last Post: 29 December 2010 - 09:34 PM

#1 HippyPanda  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 19-March 10

ADODC FILTER PROBLEM

Posted 24 March 2010 - 05:59 AM

hi i downloaded this sample adodc with datagrid from the sample the user must select an option for a search criteria to filter the datagrid and only show the rows that have the same text that had been type in the search text together with the option selected.

now i tried to implement the same search engine in my inventory system but somehow it doesnt filter nor does search the database instead it shows an error saying filter cannot be opened

heres my code for the search button

 Private Sub cmdSearch_Click()
On Error GoTo t

If optDateD.Value = True Then
    If Not txtSearch.Text = "" Then
        Adodc1.Recordset.Filter = "DeliveredDate like '%" & txtSearch.Text & "%'"
    Else
        Adodc1.Refresh
    End If
    
    If optDateO.Value = True Then
    If Not txtSearch.Text = "" Then
        Adodc1.Recordset.Filter = "OrderedDate like '%" & txtSearch.Text & "%'"
    Else
        Adodc1.Refresh
    End If
    End If
    
        If optName.Value = True Then
    If Not txtSearch.Text = "" Then
        Adodc1.Recordset.Filter = "PName like '%" & txtSearch.Text & "%'"
    Else
        Adodc1.Refresh
    End If
    End If
    
        If optBrand.Value = True Then
    If Not txtSearch.Text = "" Then
        Adodc1.Recordset.Filter = "Brand like '%" & txtSearch.Text & "%'"
    Else
        Adodc1.Refresh
    End If
    End If
    
        If optCategory.Value = True Then
    If Not txtSearch.Text = "" Then
        Adodc1.Recordset.Filter = "Category like '%" & txtSearch.Text & "%'"
    Else
        Adodc1.Refresh
    End If
    End If
    
        If optStock.Value = True Then
    If Not txtSearch.Text = "" Then
        Adodc1.Recordset.Filter = "StocksNo like '%" & txtSearch.Text & "%'"
    Else
        Adodc1.Refresh
    End If
    End If
Else
    If txtSearch.Text = "" Then
MsgBox "Select and enter seacrh criteria", vbOKOnly
    End If
End If
Exit Sub
t:
MsgBox "Error: " & Err.Description, vbCritical
End Sub


note i'm still a novice at programming can anyone help me here? thanks in advance


*found my problem its in my database i set the data type for DeliveredDate as date/time not as text so in short what my seach is looking for is text not date/time *

This post has been edited by HippyPanda: 24 March 2010 - 09:02 AM


Is This A Good Question/Topic? 0
  • +

Replies To: ADODC FILTER PROBLEM

#2 Guest_shekar*


Reputation:

Re: ADODC FILTER PROBLEM

Posted 29 December 2010 - 09:34 PM

if u r using access database the write like '" & Txtsearch.tex & "*'"

Sql database the write like '" & Txtsearch.tex & "%'"
Was This Post Helpful? 0

Page 1 of 1