Problem

Jia

Registered User.
Local time
Tomorrow, 01:03
Joined
Jan 15, 2012
Messages
14
Hello, I'm currently learning basic VBA for my O Level Coursework (7010 computer studies). I've some problems with VBA so erm I need help. :X

I created a Module called inventoryCheck, and there's a public function inventoryCheck(). I want this function to be executed everytime Access opens, so I used the AutoExec macro, where I used RunCode to run the inventoryCheck() function. But whenever I run AutoExec, it tells me that "The expression you entered has a function name Access can't find."
Can anyone help me?
Thank you!
 
I believe it's considered bad practice to have a Module (or Forms etc come to that) and a Function / Subroutine with the same name as Access may become confused.

If you rename the Function, to say doInventoryCheck(), it should work.

Here is a Wiki article that deals with naming of Database Objects, particularly the table called "The Basic LNC Database Object Tags".

The Leszynski naming convention (or LNC) is a variant of Hungarian notation popularized by consultant Stan Leszynski specifically for use with Microsoft Access development.

He, Stan Leszynski, prefixes his modules with "bas" (presumably short for BASIC as that is what it resembles), so his name for your module would have been "basInventoryCheck".

Personally I've got used to using "mod" for module but the principle is the same.
 
Last edited:
Also watch out for naming a sub, function or module the same as the project.
 

Users who are viewing this thread

Back
Top Bottom