3

Is there a compiler option in ms-access (2003) that requires all vba code to compile before allowing any code to run? I'd like to be able to turn it off. I've tried the unchecking the 'Require Variable Declaration' and 'Auto Syntax Check' options, but no result.

Background information
I've just been given an ms-access database that runs fine on their machine but will not run on my machine. I get this error message on startup:

"The expression On Open you entered as the event property setting produced the following error: Method or data member not found"  

This is caused by vba compilation errors in what looks like redundant code. Interestingly the code doesn't compile on either machine, but on their machine it database is usable on my machine it isn't! I assume its something simple like a compiler option, except I can't find it!

(Before anyone mentions it I know that the real solution to the problem is to fix/remove the bad code)

David
  • 2,101
  • 2
  • 32
  • 41

2 Answers2

2

Code will run in MS Access without all code compiling, however, On Open is a form property that runs code when the form is opened, so the code in that event will be compiled and run when the form opens. I have encountered this error before when a version of Access is run on a PC that has two versions installed (specifically, <2007 and >=2007). For me, the solution was to choose Repair from the Help menu.

Fionnuala
  • 90,370
  • 7
  • 114
  • 152
  • If I run the database on a PC with only Access 2007 installed then it will run OK. If I run in on a machine with Access 2003 and 2007 then I get error message stated in the question. Doing a Compact & Repair didn't work by the way. – David Jun 21 '11 at 15:29
  • Not a Compact & Repair, choose Detect & Repair from the Help menu to repair the installation of Access. – Fionnuala Jun 21 '11 at 19:00
  • Just tried the access 2007 version of Detect & Repair but didn't make a difference either. Looks like Detect & Repair got moved in access 2007 by the way (http://office.microsoft.com/en-gb/access-help/what-happened-to-detect-and-repair-HA010100384.aspx) – David Jun 22 '11 at 09:34
  • I might try uninstalling 2003 temporarily to see if it fixes the problem purely out of curiosity. By the way, the original question was never a 'serious' issue as such since I have been given control over the database, so I can fix the bad code, problem solved. But I'm still very much interested in how Access can behave differently on different machines given the exact same code. I appreciate your help in this matter! – David Jun 23 '11 at 14:38
1

Access has a /decompile command line switch. See the accepted answer to this StackOverflow question.

Community
  • 1
  • 1
Mike Sherrill 'Cat Recall'
  • 91,602
  • 17
  • 122
  • 185
  • 2
    I do not think decompile is the answer, in Tony Toews very good article on decompile: http://www.granite.ab.ca/access/decompile.htm, this is not really one of the problems solved. – Fionnuala Jun 17 '11 at 06:07