Can you Close or Exit an application from within a Sub or what would be the 'best practise' for Exiting when the app has failed a logic test?
My app checks for the existance of various files in a Sub Routine off the Form_Load and writes to a log along the way. In the event that 1 of these files does not exist, I want it to Exit program. But somehow while it does report False on the If File.Exists(Filename) and it does write to my log correctly, it slips past the next statement whether it is a Me.Close() or Application.Exit() and returns to the Sub Form_Load.
What puzzles me (yet may provide some clue) is that I have other If IO.Directory.Exists() and If File.Exists(Filename) statement in the Form_Load that do Me.Close properly.
Can someone explain?
In a related question and perhaps more important as a point of discussion, if I'm doing a series of repetitive tests before I move to my main logic Sub Routines, is the Sub Form_Load the place to do it or is it 'best practise' to do these in other Subs from the Form_Load?
Thanks, appreciate input on this
Edited by themaj