Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DBRichEdit results do not display periodically

Status
Not open for further replies.

sjwales

MIS
Jun 24, 2003
61
US
I have a form with a DBGrid to the left and a DBRichEdit on it to the right. The grid lists all current result set and the DBEDit will show the text of the current record.

DBRichEdit1 points to DataSource dsReview which is a TQuery. The DBRichEdit has DataField set to 'Text' (which is the name of the field in the table, badly named, I know).

This is querying from a Paradox table. There is an edit box where you can type in part of the key value of the record you want to display. The OnChange event on that Edit box basically re-executes the SQL statement after each letter.

After each execution of the OnChange event, the pointer is at the first record in the grid. Sometimes, the very first record shows no data in the RichEdit field. If I scroll down to the next record, it displayes the text just fine, but coming back to the first record again still shows me nothing.

The query basically looks like this:

select field1, field2, field3, a.text, field4
from table a
where upper(card_name) like "%' + uppercase(edtQuickFilter.Text) + '%"

I can type a long key name and watch the text in the first record come and go - it's very strange and I can't see why it's happening.

Could it be because of the badly named field that's causing some confusion? I really don't want to have to rename the field, but if you think it helps, I might have to.

Anyone seen anything like this before?

Using Delphi 5 Professional Update Pack 1 Build 6.18, running on Windows XP Professional.

Any help appreciated.

Thanks
Steve

stephen.wales@riotinto.com
 
I think your problem is in the "where" clause. The part in quotes looks as though it is being treated as a literal, and although I do not get the same results as you, it definitely does not work.

A solution that does work is to make the where clause
Code:
where card_name like :QuickFilter
and put the following in the edit box event
Code:
procedure TForm1.edtQuickFilterKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  Query1.Close;
  Query1.ParamByName('QuickFilter').AsString := '%'+edtQuickFilter.Text+'%';
  Query1.Open;
end;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top