Field Index Out of Range when trying to re-open a table with a different index 
Author Message
 Field Index Out of Range when trying to re-open a table with a different index

I have a table like the following...

Key1 (Int)
Key2 (Int)
Key3 (Int)
Text (Alpha)

Keys 1 and 2 link to a master table. There is a secondary index on the
Text field.

When the following code runs...

With Data.Table_tbl do
 begin
 Close;
 IndexName:='Secondary';
 Open;

I immediately get a 'Field Index Out of Range' error. Is it something
to do with the fact that it's a child table ?

Help !

Steve Tanner




Sun, 14 Dec 2003 23:24:37 GMT  
 Field Index Out of Range when trying to re-open a table with a different index
Yes, after the child table is opened it tries to locate the master fields
using the index. If you change the index the locate will fail (the error
message is a result of the fact that is tries to do a locate with 2 master
fields on an index with 1 field).



Quote:
> I have a table like the following...

> Key1 (Int)
> Key2 (Int)
> Key3 (Int)
> Text (Alpha)

> Keys 1 and 2 link to a master table. There is a secondary index on the
> Text field.

> When the following code runs...

> With Data.Table_tbl do
>  begin
>  Close;
>  IndexName:='Secondary';
>  Open;

> I immediately get a 'Field Index Out of Range' error. Is it something
> to do with the fact that it's a child table ?

> Help !

> Steve Tanner





Mon, 15 Dec 2003 14:45:04 GMT  
 Field Index Out of Range when trying to re-open a table with a different index
Quote:

> Yes, after the child table is opened it tries to locate the master fields
> using the index. If you change the index the locate will fail (the error
> message is a result of the fact that is tries to do a locate with 2 master
> fields on an index with 1 field).

Thanks for your reply - this had been driving me crazy. Although I
don't quite understand why it needs to use the index for the key
lookup when this is defined elsewhere. It seems a little crazy that
unless I'm missing something obvious there's no simple of way of
searching on a non-key field of a child table without resorting to
SQL.

...And there was me thinking I was becoming a good Delphi programmer
:(

Thanks again.

Steve



Mon, 15 Dec 2003 19:22:57 GMT  
 Field Index Out of Range when trying to re-open a table with a different index
If you need to look in the child table using other indexes, try using it
through another connection. You can create a second datasource/dataset that
uses only the child table. Moves in this dataconnection will be independent
of moves caused by browsing in the mastertable. When you've located a record
you need through the alphabetical index on the second dataset, you can read
the keyvalues and use this information to reposition in the mastertable.

--

Alex Haerens
AHA-design

alexhaerens _at_ hotmail _dot_ com



| I have a table like the following...
|
| Key1 (Int)
| Key2 (Int)
| Key3 (Int)
| Text (Alpha)
|
| Keys 1 and 2 link to a master table. There is a secondary index on the
| Text field.
|
| When the following code runs...
|
| With Data.Table_tbl do
|  begin
|  Close;
|  IndexName:='Secondary';
|  Open;
|
| I immediately get a 'Field Index Out of Range' error. Is it something
| to do with the fact that it's a child table ?
|
| Help !
|
| Steve Tanner
|



Mon, 15 Dec 2003 19:57:57 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. ERROR: Index Field Out Of Range

2. Field Index out of range error

3. Field index out of range

4. Field index out of range on dBase file

5. Field Index out of range

6. Field Index out of Range - Error?

7. Error: "Field Index Out Of Range"

8. Field index out of range

9. Field Index out of range

10. Range for a calculated index in dBase Table

11. Opening Indexes with fields from other databases

12. Dbase Table Level Changed when adding single field index

 

 
Powered by phpBB® Forum Software