AnsweredAssumed Answered

File Exists check

Question asked by screamingmonkey on Jan 31, 2013
Latest reply on Aug 29, 2017 by don-brimar

Title

File Exists check

Post

     So I have a database that I use to create a seperate database named differently from.  I have everything working on the PC where if the database exists it will open, if it does not it will create it.  When I take it to FMP Go it does not work anymore.  The error code I get on the PC when it can't find it is 100 on the iPad it's giving me 4.  Now the other problem is if the database does exists it still gives an error 4 that it can't find it and over writes the original database.

     I am using the following to see if the file exists.  File is setup with 2 fields combined to create a custom code for our needs.  Then it will open that file and close the current master file.  I am having to use the Open URL to open the file as the current open file can not take variables, which is really annoying.

     Import Records [No dialog; "$file"; Update existsing; Windows ANSI]
     If [Get(LastError) = 100]
       Save a Copy as ["$file"; Automatically open; copy]
     Else If [Get(LastError) = 100]
       Open URL [No dialog; "file://" & $file]
     End If
     Set Error Capture [Off]
     Close File [Current File]

      

      

     So any ideas on how to get it to check for a file before it creates one would be nice, as I can not deploy this out with the dangers of having it create a new file over top of one that has data in it already and thus delete the previous file.

Outcomes