When I click an "Exit" button on my form I want the database to prompt the user to confirm before exiting. The code I'm using below for some reason works fine at home on my Win '98 machine but not at work on my NT machine ("Compile Error - Can't find project or library"). It doesn't seem to recognise 'myresponse'. As I need the database to work in as many environments as possible, is there any alternative code I could use?
Dim MyRepsonse As Variant
Let myresponse = MsgBox("Are you sure you want to exit?", vbYesNo, "Database Name")
If myresponse = vbYes Then
Dim stDocName As String
stDocName = "Close"
DoCmd.RunMacro stDocName
End If
Dim MyRepsonse As Variant
Let myresponse = MsgBox("Are you sure you want to exit?", vbYesNo, "Database Name")
If myresponse = vbYes Then
Dim stDocName As String
stDocName = "Close"
DoCmd.RunMacro stDocName
End If