Try this (not tested):

Sub FindDeletedRecords

'Nrows_m is the row counter
'Dim_line is the table
 
        nrows_m = 0
        Do Until EOT(dim_line) 
                nrows_m = nrows_m + 1 
                OnError GoTO error_dim_main
                Fetch Rec nrows_m From dim_line
        Loop 

Exit Sub
'--------------------------
error_dim_main:
        Print nrows_m
        Resume Next

End Sub

Peter Horsb�ll M�ller
GIS Developer
Geographical Information & IT

COWI A/S
Odensevej 95
DK-5260 Odense S
Denmark
 
Tel     +45 6311 4900
Direct  +45 6311 4908
Mob     +45 5156 1045
Fax     +45 6311 4949
E-mail  [EMAIL PROTECTED]
http://www.cowi.dk

*****CHANGE OF ADDRESS - COWI's offices in Odense are now under the same roof*****
On December 8th. 2003, Geographical Information & IT moved from Rugaardsvej 55, 5000 
Odense C to Odensevej 95, 5260 Odense S. 
Please note our new telephone, direct and telefax numbers.



> -----Original Message-----
> From: Medsker, Michael [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, January 29, 2004 3:10 AM
> To: ' ([EMAIL PROTECTED])'
> Cc: '[EMAIL PROTECTED]'
> Subject: RE: MI-L MapBasic OnError
> 
> 
> Hello Warren,
> 
> Thanks for the quick reply and help. Is there anyway to get 
> the loop to continue from the place it left off when the 
> error was encountered, so that I can continue to look for 
> deleted records?
> 
> Thanks
> Mike
> 
> -----Original Message-----
> From: Warren Vick, Europa Technologies Ltd. 
> [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, January 28, 2004 7:55 PM
> To: 'Medsker, Michael'; [EMAIL PROTECTED]
> Subject: RE: MI-L MapBasic OnError
> 
> 
> Hello Michael,
> 
> The reason for your error is that once your fetch has been 
> done (successfully or not) the code for your error handler is 
> encountered and the "resume next" is called without the 
> context of an error. You need to terminate your subroutine 
> with an "exit sub" (or "exit function" if it's a
> function) *before* the error handler so that this code is 
> really only called as the consequence of an error. Hope that 
> solves the problem.
> 
> Regards,
> Warren Vick
> Europa Technologies Ltd.
> http://www.europa-tech.com
> 
> 
> -----Original Message-----
> From: Medsker, Michael [mailto:[EMAIL PROTECTED] 
> Sent: 29 January 2004 01:37
> To: ' ([EMAIL PROTECTED])'
> Subject: MI-L MapBasic OnError
> 
> 
> Hoping someone can help me with a MapBasic question. I'm 
> trying to use Fetch to get Objects using Rec # from a table 
> which contains deleted records. Don't want to Pack first. I 
> want to be able to note which row/record #s were marked for 
> deletion. Below is a test that I played with to see if I 
> could get MapBasic to print the rec number every time it hits 
> a deleted record and then print the total number of rows at 
> the end. It doesn't work. The problem seems to be that Resume 
> try's to invoke every time the loop starts instead of just 
> when a deleted record is found. I get a "Found Resume while 
> not process an error, application halted" message. Note that 
> I have moved the
> error_dim_main: out of the loop but the Resume Next doesn't 
> work after the error, which is understandable because I 
> jumped out of the loop.
> 
> Nrows_m is the row counter
> Dim_line is the table
> 
> 
> nrows_m = 0
> Do While Not EOT(dim_line) 
> nrows_m = nrows_m + 1 
> OnError GoTO error_dim_main
> Fetch Rec nrows_m From dim_line
> error_dim_main: 
>       Print nrows_m
>       Resume Next
> Loop 
> 
> 
> Any suggestions would be appreciated.
> 
> Thanks
> Mike
> 
> ---------------------------------------------------------------------
> List hosting provided by Directions Magazine | 
> www.directionsmag.com | To unsubscribe, e-mail: 
> [EMAIL PROTECTED]
> For additional commands, e-mail: 
> [EMAIL PROTECTED]
> Message number: 10137
> 
> 
> 
> ---------------------------------------------------------------------
> List hosting provided by Directions Magazine | 
> www.directionsmag.com | To unsubscribe, e-mail: 
> [EMAIL PROTECTED]
> For additional commands, e-mail: 
> [EMAIL PROTECTED]
> Message number: 10141
> 
> 
> 

Reply via email to