• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1129
  • Last Modified:

Standard Declaration Module

1. Where is the "Standard Declaration Module" in ms Access?

2. How do I get to the " "Standard Declaration Module" in ms Access?

3.How and where do I put the following code in the  "Standard Declaration Module" in ms Access?

Public gblnRegistered as Boolean
0
cssc1
Asked:
cssc1
5 Solutions
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
See the images below.

mx
Capture1.gif
Capture2.gif
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
1) Each Module (regular or Form/Report) has a Declarations section

2) Create a New Module if necessary ... which will automatically put you in the Declarations section.
Otherwise, do as show in image 1 above.

3) See image 2 above.

mx
0
 
RgGray3Commented:
You would create a standard module   (Modules container, NEW)

Just start making your declarations...

Make them public as you have shown in your example...
They are available

Anything before the first Sub or function is the declarations section

For more information refer to scope in the help util
Understanding the lifetime of variables
Understanding Scope and visibility
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
I think you're referring to the "General Declarations" section of a "Standard Module". I've added a screenshot that might be a bit more clear.

To create a module, you can either use the Database window as suggested earlier, or you can do it directly in the VBA Editor by clicking Insert - Module (or by right-clicking in the Project Explorer and selecting Insert - Module).
EE-GenDec.png
0
 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
<<1. Where is the "Standard Declaration Module" in ms Access?>>

  Just to add a bit, you have three basic types of modules:

1. A module attached to a form or report
2. A Standard module
3. A Class module.

  All can be accessed by the VBA editor window.   All have a declartions section at the top where you can declare variable (use a dim statement) and constants (use a const statement).

  Where and how you delcare something determines what can see that variable.  For example, when you declare a variable at the procedure level, only code in the procedure can see that vairable.   When you do it at module level, if declared with the keyword private, only code in that module can see the variable.  If you declare it as Public, then it can be see from any module.

HTH
JimD.
0
 
cssc1Author Commented:
Thank you all!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now