What layout are you on when the interface file is closed? Your file may be opening to a layout that does refer to the data file before the "on open" settings can change layouts to one that doesn't. If this is a possibility, open the interface file and manually select a blank layout before closing the file, then put it back up and see if you get the same error when you open the front end file on the client. If that works, you may want to add an "on close" script that changes to your blank layout when you close the file.
I have an on close script that goes to my main layout, which is a table with just one record and global variable fields.
Are you sure that the layout is free of references to the data file? Custom menus and value lists can contain external data source references and these can trigger an attempt to open the data file.
So just to double check, i created a new layout with nothing on it that is based on a new table occurence of my main global variables table that has no relation to any other table. I created a new startup and shutdown script that just goes to that layout.
Still, as soon as I open the file, the first thing that happens, even before the startup script runs, is it tells me that it can't find the file from the server...
Ideally, what I want is:
1) to be able to check via a script if I have internet connection, so that if I don't it stops there and alerts the user to connect to a network first before he can procede
2) control when my file tries to access the table occurences form external data, so that I can control via script that it only tries to connect to that file, and maybe even complement with being able to catch the error in the script and displaying a custom message and not filemakers message that prompts you to look for the file. I don't want users looking for the file, the file is in one place I've coded it in, and and if the file changes places I can just update the client verison.
Just ran a few tests and it triggered a possible explanation. In layout set up for your blank layout, what table occurrence is specified in "show records from"?
If it refers to a table in the data file, the data file will open even though there are no fields from that table present on the layout. Create a dummy table, it can have 0 fields defined, in the interface file. Base your layout on that and according to my tests, you should not get that unwanted attempt to find and open the data file if that is the file first accessed when you open the interface file.
What I did to test this:
Created two files, Interface and Data. Interface has a zero record, zero field table called "Interface". Data has a single table called "Data" with a single field called "testtext". I added an occurrence of Data to the interface file and creatd a second layout named "Data" that refers to "Data" in "show records from". That gives me two layouts: Interface, based on the dummy table in Interface and Data, based on the data file's table. If I access the Data layout, the system opens Data in a hidden window and I can see it in Windows | Show. With "interface" as the first layout accessed when the file opens, Data does not open in that manner until I access the "Data" layout.
As a further test, I then closed the files and changed the name of the Data file to "break" the external data source reference to it. I do not get the "can't find the file" error message until I switch from the interface layout to data.
I created a new table, just one occurrence, no records, no fields. I called it blank. Set up the shutdown script to go to it. Still, as soon as I open the file before the start up script, FM tells me it can't find the hosted file that has several occurrence in this file. It just happens there however. In every other moment that the client is using info from the hosted file, I can catch an error en the script and have my messages pop up saying "make sure you are connected to the internet" for example. I checked for custom functions, nothing relates to the data file.
What happens if you create a relationship between your Interface and Data? That is the only thing I can think that is different—in essence, between your tests and my files.
I did not related the dummy table (interface) to any other. I couldn't as I did not define any fields in interface to use in such a relationship.
Adding such a field and establishing a relationship between interface and data did not change the results--I can open the database to the interface layout and no error message pops up if I have first moved or renamed the dat file.