Thank you to all those who replied to my query of determining whether a
table needs packing. I basically had two solutions, these being;

1) Fetch each record from the table. If a record is deleted then an error
occurs when it is accessed. This can then taken as though a table would need
packing. See source code below;

Function IsPacked(Byval Tabname as string) as Logical

        Dim nRows as Integer
        Dim nRec as Integer

        nRows = TableInfo(TabName, TAB_INFO_NROWS)

        OnError Goto BadFetch

        For nRec = 1 to nRows
                Fetch rec nRec from Tabname
        Next

        IsPacked = TRUE
        Exit Function

        BadFetch:
        IsPacked = FALSE
End Function


2) Using the 'SELECT' command to select all of the non-deleted records into
a temporary table, and then determine the number of rows using the TableInfo
function. See source code below;

        Select * From ... Where col1=col1 Into TempSel Noselect
        iNumRealRows = TableInfo(TempSel, TAB_INFO_NROWS)
        Close Table TempSel


Regards,
 
Paul Fildes                                   Phone: +44 121 643 6711
Technology Applications Group, Maunsell Ltd,  Fax:   +44 121 643 1357
Attwood House, 1 Worcester Walk,              Email: [EMAIL PROTECTED]
New Street, Birmingham B2 4NX, UK             URL:   www.maunsell.co.uk
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to