By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,849 Members | 2,169 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,849 IT Pros & Developers. It's quick & easy.

Library database public variable definition

P: 2
Hi, can someone point me to general rules for defining variables on a code library database.

I'm setting up my first library database and trying to transfer code from two applications into it.

A problem arises because there are some public variables which are used by the VBA in the library database and the applications - whichever place i declare the variable in, the other ones say the variable isn't declared even tho i have set a reference to the library DB.

i am declaring thus: Public Errorplace As String and using Access 2003.

Is it possible to share variables between them all?

Thank you
Andrew
Jan 2 '07 #1
Share this Question
Share on Google+
1 Reply


ADezii
Expert 5K+
P: 8,636
Hi, can someone point me to general rules for defining variables on a code library database.

I'm setting up my first library database and trying to transfer code from two applications into it.

A problem arises because there are some public variables which are used by the VBA in the library database and the applications - whichever place i declare the variable in, the other ones say the variable isn't declared even tho i have set a reference to the library DB.

i am declaring thus: Public Errorplace As String and using Access 2003.

Is it possible to share variables between them all?

Thank you
Andrew
From my programming experience it is possible to do what you have suggested
although it is universally discouraged since it makes programs harder to
maintain and Debug. But if you insist, you must resolve the ambiguity between
the Public Variables now co-existing in the same application by fully qualifying them as in:

Expand|Select|Wrap|Line Numbers
  1. 'Declared in mdlMain
  2. Public MyID As String
  3.  
  4. 'Declared in Module1
  5. Public MyID As String
  6.  
  7. mdlMain.MyID = <some string>
  8. Module1.MyID = <still another string>
You essentially now have 2 Variable Declarations and assignments to MyID
Jan 2 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.