Hi there.
The only way I know of how to pick up on the Windows log off event is to have code in the Query_Unload of the form. See below.
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
'Unload modes
'0 The user has chosen the Close command from the Control-menu box on the form.
'1 The Unload method has been initiated from code.
'2 Windows is logging off.
'3 Task Manager is closing the application.
'4 An MDI child form is closing because the MDI form is closing.
Select Case UnloadMode
Case 2
'Windows is logging off. System initiated close
'Do your stuff here
Case Else
Debug.Print "Unload mode: " & CStr(UnloadMode)
End Select
End Sub