Record NOT Found 
Author Message
 Record NOT Found

Hi

I have two DBComboboxes linked to two datasources which in turn are then
linked to two tables

I am using the first datasource/table as the mastersource for the second
so when the value of the first combobox changes, the items in the second
follow suit.

My problem is with the feature that allows you to press a key to
automatically jump to the nearest matching record. e.g. If I press D the
combobox should jump to the first record beginning with D.

This works if I am on the first record of the master table. I can press
a key in the second combobox and get the desired results.
However if I select a different value in the first combobox (thereby
moving of of the first record) when I drop down the second combobox and
press a key I get the error "Record NOT Found"

I have had a quick look at the VCL source but cant really find what I'm
looking for. I am using delphi 3.

Anybody seen this before or know how to fix it !!!

Regards
Dom



Fri, 24 Jan 2003 03:00:00 GMT  
 Record NOT Found
Hello,

for an incremental search you could put the following codeline in
DBComboBox1.OnChange event:

Table1.FindNearest([DBCombobox1.Text]);

:)
Kai Inge


Quote:
> Hi

> I have two DBComboboxes linked to two datasources which in turn are then
> linked to two tables

> I am using the first datasource/table as the mastersource for the second
> so when the value of the first combobox changes, the items in the second
> follow suit.

> My problem is with the feature that allows you to press a key to
> automatically jump to the nearest matching record. e.g. If I press D the
> combobox should jump to the first record beginning with D.

> This works if I am on the first record of the master table. I can press
> a key in the second combobox and get the desired results.
> However if I select a different value in the first combobox (thereby
> moving of of the first record) when I drop down the second combobox and
> press a key I get the error "Record NOT Found"

> I have had a quick look at the VCL source but cant really find what I'm
> looking for. I am using Delphi 3.

> Anybody seen this before or know how to fix it !!!

> Regards
> Dom



Fri, 24 Jan 2003 03:00:00 GMT  
 Record NOT Found
Thanks for the reply

The 1st combobox autosearch ALWAYS works OK, Its the second one that
generates the error. If I was to implement your suggestion, how would I
override the default behaviour which is to jump to the nearest match

Dom



Fri, 24 Jan 2003 03:00:00 GMT  
 Record NOT Found
Hello again,

I would have used two editfields and two dbgrids, instead of DBComboboxes.
Then you have free hands with indexing, filtering and can control the
behavior yourself.
I never use Master/Detail properties, but put the searching line
Table2.FindNearest([Table1.Fieldbyname('MYFIELD').Asstring;
 in OnDataChange event of the DataSource1. Then table2 will follow table1
and you can put
Table2.FindNearest([Edit2.Text]);
in Edit2.OnDataChange, and
Table1.FindNearest([Edit1.Text]);
in Edit1.OnDataChange events to separately search the two tables.
Then you have the same function as if you had used the tables Master/Detail
properties and can still search them separately without problems.

:)
Kai Inge


Quote:
> Thanks for the reply

> The 1st combobox autosearch ALWAYS works OK, Its the second one that
> generates the error. If I was to implement your suggestion, how would I
> override the default behaviour which is to jump to the nearest match

> Dom



Fri, 24 Jan 2003 03:00:00 GMT  
 Record NOT Found
Hi

Thanks again for your help.

Unfortunately, I need the drop downs to limit the data that can be
entered, however you have given me another thought, maybe instead of the
Master/Detail I could use cancelrange & setrange to mimic the behaviour
I'm after, and hopefully it wont generate a {*filter*} error

Regards
Dom



Fri, 24 Jan 2003 03:00:00 GMT  
 Record NOT Found
Hello again,

I also like to use filters to achieve a Master/Detail behavior. Then you
also get a 'multi select' effect, as several records in Table2 grid gets
visible because they belong to one record in Table1. (I.e. have a field
content in common.) You set the filter in DataSource1.OnDataChange event:
Table2.Filter := 'MYFIELD = ' Table1.Fieldbyname('MYFIELD').Asstring;
Table2.Filtered := True;
Remember to set Table2.Filtered := False; if you want to do a incremental
search on it.

If you want to do a incremental search on Table1: In the
DataSource1.OnDataChange event wrap the filter setting in a
If FilterSettingOk then . . . to get able to 'shut it off' to increase the
speed of the incremental search, and on again when hitting the intended
record in Table1. Otherwise the typing of the search item will be in slow
motion.

:)
Kai Inge


Quote:
> Hi

> Thanks again for your help.

> Unfortunately, I need the drop downs to limit the data that can be
> entered, however you have given me another thought, maybe instead of the
> Master/Detail I could use cancelrange & setrange to mimic the behaviour
> I'm after, and hopefully it wont generate a {*filter*} error

> Regards
> Dom



Fri, 24 Jan 2003 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Record not found

2. Ttable.locate and "Record not found" error

3. Why does Locate raise a EDatabase error with message Record not found?

4. FindKey does not always find a record

5. bookmark on prior record not current record.

6. Please HELP: class not found

7. Table Not Found Errors

8. Field 'PHYSICALTYPE' not found

9. Table not found problem with BDE3.5

10. .hostdef not found: Oracle 8i-BDE-SQLLink

11. StoredProc --> Error : Could not find object

12. BDE Setup Error "Object Not Found"

 

 
Powered by phpBB® Forum Software