I found the following in the Delphi Help.
To create a filter using the Filter property, set the value of the property to a string that contains the filter’s test condition. For example, the following statement creates a filter that tests a dataset’s State field to see if it contains a value for the state of California:
Dataset1.Filter := 'State = ' + QuotedStr('CA');
You can also supply a value for Filter based on text supplied by the user. For example, the following statement assigns the text in from edit box to Filter:
Dataset1.Filter := Edit1.Text;
You can, of course, create a string based on both hard-coded text and user-supplied data:
Dataset1.Filter := 'State = ' + QuotedStr(Edit1.Text);
I have a form with a DBGrid and thousands of records. I have an edit box on the form for users to enter a name to search for when the 'SEARCH' button is pressed.
I have the following in my 'SEARCH' button on click:
when i press the search button I get the Access Violation error.
Any clue what I'm doing wrong? The Filter property of the query is True.
Thanks! Leslie
landrews@metrocourt.state.nm.us
SELECT * FROM USERS WHERE CLUE > 0
No Rows Returned
To create a filter using the Filter property, set the value of the property to a string that contains the filter’s test condition. For example, the following statement creates a filter that tests a dataset’s State field to see if it contains a value for the state of California:
Dataset1.Filter := 'State = ' + QuotedStr('CA');
You can also supply a value for Filter based on text supplied by the user. For example, the following statement assigns the text in from edit box to Filter:
Dataset1.Filter := Edit1.Text;
You can, of course, create a string based on both hard-coded text and user-supplied data:
Dataset1.Filter := 'State = ' + QuotedStr(Edit1.Text);
I have a form with a DBGrid and thousands of records. I have an edit box on the form for users to enter a name to search for when the 'SEARCH' button is pressed.
I have the following in my 'SEARCH' button on click:
Code:
procedure TfrmPriorServ.btnSearchFindClick(Sender: TObject);
begin
JMSData.qrySearch.Datasource.DataSet.Filter:= 'LASTNAME = ' + QuotedStr(frmPriorServ.edLastNmCrit.Text);
end;
when i press the search button I get the Access Violation error.
Any clue what I'm doing wrong? The Filter property of the query is True.
Thanks! Leslie
landrews@metrocourt.state.nm.us
SELECT * FROM USERS WHERE CLUE > 0
No Rows Returned