Carl, I hesitate to suggest something quite so obvious, but it seems to me that each time you enter the On Startup method, you
1. Set $dataPath to a path 2. Test $dataPath is “”, which of course it isn’t 3. Open a data file 4. Set $dataPath to “” (effectively pointless) 5. Re-enter On startup when the new data file opens 6. Go to step 1; hence your loop From the OPEN DATA FILE documentation: If the access path sets a valid data file, 4D quits the database in progress and re-opens it with the specified data file. In single-user mode, the Semaphore <file:///4Dv17/4D/17/Semaphore.301-3730607.en.html> and the On Startup database method <file:///4Dv17/4D/17/On-Startup-database-method.301-3730029.en.html> are successively called. Warning: Since this command causes the application to quit before re-opening with the specified data file, it must be used with precaution in the On Startup database method <file:///4Dv17/4D/17/On-Startup-database-method.301-3730029.en.html> or in a method called by this database method, so as to avoid generating an infinite loop. Jeremy > On 27 Oct 2019, at 17:31, wangel--- via 4D_Tech <[email protected]> wrote: > > I am trying to use <OPEN DATA FILE> in "On Startup" but I get an endless > loop. The code is: > > C_TEXT($dataPath) > > $dataPath:="C:\\MyFolder\\MyData.4dd" > > If ($dataPath#"") > > OPEN DATA FILE($dataPath) //open it > > $dataPath:="" > > End if > > What am I doing wrong? > > Regards > > Carl Aage Wangel ********************************************************************** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:[email protected] **********************************************************************

