Hi Neil,
>1, There are exactly 2,929,716 records in pdmlog which WILL NOT grow anymore as this is now an archived table.
This is a reference constant table.
2, The maximum possible value for Reccount('temp') will be 1 ALWAYS. There will only be the ability to select 1 record.
Ok, i understand because you don't put temp cursor on the select
3, On the pdmlog there is no index on the mainkey - STRANGE!!!
This is the first problem.
First solution:
....
PRIVATE keySelected
WITH thisform.pageframe1.page1.List1
FOR ix=1 TO .Listcount
IF .Selected[m.ix]
STORE PADR(.List(m.ix),fsize('mainkey','result')) TO keySelected
EXIT
ENDIF
ENDFOR
ENDWITH
IF VARTYPE('keySelected')='C'
SELECT user, database, type, date, time FROM U:\Logs\310703\pdmlog.dbf WHERE mainkey='&keySelected' into cursor crsmatch
thisform.pageframe1.page1.grid1.RecordSource = 'crsmatch'
ENDIF
This is a palliative, VFP scan all 2.9XX.XXX for found keySelected occurrences.
The master simple way is to add, to U:\Logs\310703\pdmlog.dbf a INDEX mainkey TAG and open it ( result is immediate if index and table are local file); the best way, for static table is to implement a hashing coding for traslate, but this is not usefull with VFP SELECT.
Now i see "U:\", then U:\Logs\310703\pdmlog.dbf is a remote network table ?
Neil, also INDEX mainkey TAG cannot save you, but it can to be more slower (VFP need to read INDEX and TABLE on the net).
Simple solution is to copy U:\Logs\310703\pdmlog.dbf on local file system,
and index it ( table is costant !).
Another solution for gain time, is:
- INDEX remote table;
- use a ODBC VFP connection, and send SELECT via ODBC;
if this no go well ( i use SQL, and have used VFP ODBC sporadically),
you need to implement a remote application and call it ( hard to implement ).
Note: Use m. prefix for read variables, it is faster and can protect you by strange result.
Fabio