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

New Topic/Question
Reply



MultiQuote


|