in every form in your project you should have in the Form_Unload() sub the End event:

Private Form_Unload()
'terminate the program
End
End Sub

or you can do something like everywhere you have the user manually closing the program by clicking a command button you unload all the forms:

Private cmdExit_Click()
Unload Form1
Unload Form2
.
.
etc...

'terminate the program
End
End Sub

i don't know if that's exactly what you were looking for but i hope it helps nonetheless. take care.