On Jun 25, 2006, at 3:01 PM, <[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


A more general approach is to add a module method or class to your projects that evaluates file errors, for example in a module or window:

Sub ReportFileError(f as folderItem)
  dim Error as integer = f.LastErrorCode
  Select Case Error
  Case 101
    MsgBox "The file was not found"
  Case 102
    MsgBox "Access to this file was denied"
  Case 104
    MsgBox "This file is in use"
  Case 105
    MsgBox "You used an invalid name"
  End Select
End Sub

Then your file opening code can be along these lines:

...
If file = nil then
  msgbox "A file error occured"
End if
filereadfrom = file.OpenAsTextFile
If filereadfrom = nil then
  ReportFileError file
Else
  //Do your stuff
  filereadfrom = nil
End


Best regards,

Jack
_______________________________________________
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