This might solve the problem you have now, but it doesn't always work. As
Jonathan said, you should add this line "if filereadfrom<>nil then"
after "filereadfrom=file.OpenAsTextFile"

And I'd place the "until filereadfrom.EOF" after the Do, and not the Loop.

this means it would look like this:

if file <> nil and file.exists then  'is file nil and does it exist?
  filereadfrom=file.OpenAsTextFile  'open as a text file
  if filereadfrom <> NIL then
    do  until filereadfrom.eof
      nameholding = filereadfrom.readline <------err's at this point, but
not anymore
      passwordholding=filereadfrom.readline
      securitylevelholding = filereadfrom.readline
      if  editUserName.text=nameholding and
editPassword.text=passwordholding then
        timerLogin.enabled = false 'disable the timer, cuz they've entered
a valid value
        txtTimeRemaining.Visible=false 'hide the text for the countdown
        txttimerval.Visible=false               'and hide the counder
itself...
        'going to have to change the quit to something else
        winTroubleType.show
      end if
    loop
 end if
end if

On 26/06/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

Hi again.

I've got it working, kinda...

I added an if statement, that goes

if file.exists= false then
  MsgBox ("No Master Access File")
end if

This works... but is it graceful <smile>

Michael
>
> From: Jonathan Johnson <[EMAIL PROTECTED]>
> Date: 2006/06/25 Sun AM 08:23:27 EST
> To: REALbasic NUG <[email protected]>
> Subject: Re: exception error
>
>
> On Jun 25, 2006, at 7:18 AM, <[EMAIL PROTECTED]> wrote:
>
> > As per your request, here is the copy of my code where the program
> > err's out.
> >
> > ===========================================
> >   if file <>nil then  'is the file empty?
> >     filereadfrom=file.OpenAsTextFile  'open as a text file
> >     do
> >       nameholding = filereadfrom.readline <------err's at this point
>
> There are many situations that OpenAsTextFile will fail: 1) The file
> does not exist (check for File.Exists), 2) You don't have permissions
> to read the file, 3) The file is open for writing by either you or
> another process. You should add a check for "filereadfrom" being nil.
>
> HTH,
> Jon
>
>
> --
> Jonathan Johnson
> REAL Software, Inc.
>
> _______________________________________________
>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to