Solved

Standard Declaration Module

Posted on 2011-02-13
6
1,114 Views
Last Modified: 2012-05-11
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
Comment
Question by:cssc1
6 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) earned 200 total points
ID: 34884298
See the images below.

mx
Capture1.gif
Capture2.gif
0
 
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Access MVP)
DatabaseMX (Joe Anderson - Access MVP) earned 200 total points
ID: 34884307
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
 
LVL 11

Assisted Solution

by:RgGray3
RgGray3 earned 100 total points
ID: 34884419
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
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 84

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 100 total points
ID: 34884504
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
 
LVL 57

Assisted Solution

by:Jim Dettman (Microsoft MVP/ EE MVE)
Jim Dettman (Microsoft MVP/ EE MVE) earned 100 total points
ID: 34887347
<<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
 

Author Closing Comment

by:cssc1
ID: 35003440
Thank you all!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now