Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-access > #10603

Re: On Error not working

From "Phil" <phil@stantonfamily.co.uk>
Newsgroups comp.databases.ms-access
Subject Re: On Error not working
Date 2015-04-10 07:16 +0100
Organization Aioe.org NNTP Server
Message-ID <mg7psl$nu4$1@speranza.aioe.org> (permalink)
References (1 earlier) <eb16bec6-4e02-4ee1-83f2-efd337b8d4c2@googlegroups.com> <mg1414$mo6$1@speranza.aioe.org> <6etbia9mqardpf93pmhhhq5o971hl5p0md@4ax.com> <mg58rq$al9$1@speranza.aioe.org> <mg6p6h$r0k$1@dont-email.me>

Show all headers | View raw


On 09/04/2015 21:59:54, "Ron Paii" wrote:
> 
> 
> "Phil" <phil@stantonfamily.co.uk> wrote in message
> news:mg58rq$al9$1@speranza.aioe.org...
>> On 09/04/2015 04:53:45, Larry Linson wrote:
>>> On Tue, 7 Apr 2015 18:27:00 +0100, "Phil" <phil@stantonfamily.co.uk>
>>> wrote:
>>>
>>> As best I can tell, Phil, you simply repeated the post about which
>>> Patrick asked "what is the issue?"  It was code, with no explanation
>>> of what you expect, what is actually happening, and why you think "On
>>> Error Not Working". That's rather like expecting someone who doesn't
>>> speak your language to understand if you only say it louder.
>>>
>>> Just posting code that doesn't work as you think it ought to work is
>>> not sufficient information for anyone to assist you. Sorry.
>>>
>>> Larry
>>>
>>
>> Patric, Larry, sorry for the confusion.
>> I was having rtouble with my news reader and the correct post went wrong.
>>
>> Try again
>>
>> What I am doing is reading a web page into a text file
>> and scanning the text file for sequences of words which
>> eventuall allow me to extract a share price.
>> This works perfectly unless the Web page is experiencing
>> a problem, and in this case I suspect that the required
>> sequence does not exist.
>>
>> Most of the relevent code is here.
>>
>> Dim Word as String
>>
>> OpenTempFile:
>>    ' Open file for output.
>>    Open TempFile For Output As #1
>>
>>    Print #1, xmlHttp.responseText
>>
>>    Close #1
>>
>>    Open TempFile For Input As #1
>>
>>    Do While Not EOF(1)
>> NextLine:
>>        On Error GoTo GetShareValue_Err
>>        Line Input #1, Word
>>
>> GetShareValue_Exit:
>>    Exit Function
>>
>> GetShareValue_Err:
>>    If Err = 62 Then
>> FileEndFound EndFound = FileEndFound + 1 ' The temp file may not have any
>> linefeeds, ' so try for for other codes
>>        If FileEndFound < 2 Then                            ' 2 attempts
>>            Err.Clear
>>            GoTo CheckCode
>>        Else
>> MsgBox MsgBox "Failed to find the price - the code may be wrong",
>> vbInformation             Call Shell(NotepadFile & " " & TempFile)
>>            GoTo GetShareValue_Exit
>>        End If
>>    ElseIf Err = 55 Then                    ' File already open
>>        Close #1
>>        GoTo OpenTempFile
>>    ElseIf Err = -2147352567 Then           ' No current record
>>        MsgBox "No search string have been set", vbCritical
>>        GoTo GetShareValue_Exit
>>    Else
>>        MsgBox Err & "  " & Err.Description
>>    End If
>>
>> The problem is that on the  line Line Input #1, Word,
>> I get a runtime error 62 - Input past end of file
>>
>> It fails to run the error routine.
>>
>> Phil
>>
>> ---
>> This email has been checked for viruses by Avast antivirus software.
>> http://www.avast.com
>>
> 
> You never resume from the error; replace the "Go To" statements with
> "Resume" inside you error code. I would also move the "On Error" statement
> to before you attempt to open the file. Open is much more likely to fail
> then Line Input.
> 
> 

Thanks, Ron. Think you may be right. Can't really check it till the Website
goes down.

Actually I had the On Error statement further up the coding before the Open
TempFile but put it in a second time just for luck.

Phil

Phil

---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com

Back to comp.databases.ms-access | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

On Error not working "Phil" <phil@stantonfamily.co.uk> - 2015-04-07 14:51 +0100
  Re: On Error not working Patrick Finucane <patrickfinucanetx@gmail.com> - 2015-04-07 06:59 -0700
    Re: On Error not working "Phil" <phil@stantonfamily.co.uk> - 2015-04-07 18:23 +0100
    Re: On Error not working "Phil" <phil@stantonfamily.co.uk> - 2015-04-07 18:27 +0100
      Re: On Error not working Larry Linson <larry.linson@verizon.net> - 2015-04-08 22:53 -0500
        Re: On Error not working "Phil" <phil@stantonfamily.co.uk> - 2015-04-09 08:13 +0100
          Re: On Error not working Larry Linson <larry.linson@verizon.net> - 2015-04-09 15:08 -0500
            Re: On Error not working "Phil" <phil@stantonfamily.co.uk> - 2015-04-10 07:11 +0100
              Re: On Error not working Larry Linson <larry.linson@verizon.net> - 2015-04-10 21:54 -0500
          Re: On Error not working "Ron Paii" <None@none.com> - 2015-04-09 15:59 -0500
            Re: On Error not working "Phil" <phil@stantonfamily.co.uk> - 2015-04-10 07:16 +0100

csiph-web