I recently loaded Access2000 on a new computer (running WinXP/SP2). It is the same version of Access as was running on the old computer (running WinXP/SP1). None of the macros that ran fine on the old computer run on the new one. In fact, although the macros are clearly evident in the VBE, when I click on their relevant command button I get an error suggesting that either the macro does not exist or there is some faulty linkage between the command button and the macro. For example, I have a form with a dozen or so command buttons. One button is named "TodaysDate". The corresponding macro has been reduced to:
[VBA]
Private Sub TodaysDate_Click()
MsgBox "TodaysDate_Click"
End Sub
[/VBA]
When I click on the button, an error message appears stating:
The expression On Click you entered as the event property setting produced the following error: Variable not defined
When I explore button properties, On-Click takes me right to the appropriate macro.
- The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure]
- There may have been an error evaluating the function, event or macro
Any help would be appreciated.
UPDATE: well, it gets even stranger ...
assuming that there was some flag/option/something that needed to be toggled, I explored just about any menu that might have something to irritate me. Found nothing.
I then went back and tried to edit one of the malfunction macros and was told that I did not have exclusive access to the DB and any changes would be lost. I did not get that error previously. So I looked at the file owner and noticed that it was the admin group on my machine vs an individual owner. I run as administrator only when I need to do something scarey and run as me other times (I am a member of the admin group). I tried to change the owner to "me", but no dice. So, I logged off and logged in as the administrator and tried the same macros -- same error. I then tried to change the VBA code(just to see what would happen) and Access let me do that without any complaining. I undid that one edit and went back to the main form ... and then a miracle happened -- all the macros ran fine. So I exited the program, logged off as administrator and logged back on as "me". And, you guessed it -- everything works fine.
So, what might have been going on?