The Linux Page

MS-Access weird = [Field] error...

I started using MS-Access not too long ago, but this one is really getting me each time.

Once in a while I get this error telling me that the Form is messed up, that a field or a macro just do not match. That macros are missing even though I ask the Form to call the corresponding functions. And some other strangeness like those.

Actually, it happened again to me today. The Form_Open() function would not work, so I commented it out (you can also just rename the macro for that purpose!) Then I put some break points to see whether the functions that the Open() function was calling could generate this problem.

The result was not much better. The form would open, but all the buttons failed and the drop-down themselves would work (i.e. we could see the Dropdown with the selection) but their AfterUpdate() would not be called.

So what could cause such a thing? I just added a few macros that look just fine (I have that auto-syntax system...)

After a few more tries, I finially thought: Hey! That macro I just added has the same name as a button in the form, maybe that's it? You bet it was!

You simply cannot reuse the name of a button or label or whatever widget in your form if you already were using that same name in your macros, and vice versa.

This is quite tricky, if you ask me. I guess I'd have to be more careful and maybe that all the standalone functions should be marked with a special name such as IntFunc_... for Internal Function. That would prevent such problem. (And of course, you can do that on each button, edit text, label, combo, etc.)