View Full Version : Compile Error for 'myresponse'


Maestro
11-15-2001, 12:40 AM
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

anke
11-15-2001, 02:03 AM
You've spelt myresponse/myrespsonse differently in the code to the declaration - leave in option explicit at the top and any errors like that will be flagged for u. Also a correct entry will change the capitalization of the var to its declaration

Anke

Maestro
11-15-2001, 03:15 AM
Oops! well spotted. If only everything were that simple to sort out...