Advertisement

10.04.2007 at 07:11AM PDT, ID: 22872079
[x]
Attachment Details

Global variables in Access VBA - How?

Asked by Angelp1ay in Access Coding/Macros, Microsoft Access Database, Access Forms

Tags: access, global, vba, variable

*************
* Background *
*************

I need to store and update data in a load of global variables:
- When I load up forms I pre-populate the fields with this data.
- When controls are changed the global fields I update the globals

I have sucessfully defined my variables in a module like this:
    ' Setup globals
    Global gblUser As Integer
    Global gblSampler As Integer
    Global gblProject As Integer
    Global gblExportPath As String

*************
* The problem *
*************

When I hit an error all the globals are lost (reset to default non-initiated values - "" or null or something).

********
* Ideas *
********

- Everytime I call a global I check it's not blank - if it is I reset globals to defaults.
- Save the values of globals in a db table.
- Open a form and set controls in this form to the global values. Grab / update the data straight from here.

***************
* My question!!! *
***************

What is the best way to store "globals" in Access?

Please feel free to add your own ideas - preferably really good ones :oDStart Free Trial
[+][-]10.04.2007 at 07:13AM PDT, ID: 20014253

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.04.2007 at 07:13AM PDT, ID: 20014258

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]10.04.2007 at 07:23AM PDT, ID: 20014331

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.04.2007 at 07:28AM PDT, ID: 20014378

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.04.2007 at 07:44AM PDT, ID: 20014543

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.04.2007 at 07:47AM PDT, ID: 20014569

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Access Coding/Macros, Microsoft Access Database, Access Forms
Tags: access, global, vba, variable
Sign Up Now!
Solution Provided By: jimhorn
Participating Experts: 2
Solution Grade: A
 
 
[+][-]10.04.2007 at 08:16AM PDT, ID: 20014864

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.04.2007 at 08:37AM PDT, ID: 20015063

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]10.04.2007 at 09:06AM PDT, ID: 20015286

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.05.2007 at 03:12AM PDT, ID: 20020618

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628