473,396 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Globals variables. I don't know to do corretly

Hello!

I need to get informations at initialization of database access program, like Institution Name, Address, City and tels, register them in variables (globals) and put them at header of report.
I don't knowing to do corretly.
Please anybody can help me?

Thank

Messias Ribeiro
Brazil.
Feb 18 '15 #1
1 771
jforbes
1,107 Expert 1GB
A really easy way is to create a Module and put something like this into it:
Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3. Global Const mVersion = "3.017"
  4. Public Function getVersion() As String
  5.     getVersion= mVersion 
  6. End Function
This creates a Constant and a function to return the value of that Constant. Then in your Report, you can drop a TextBox in the Header and set the ControlSource of the TextBox to something like
Expand|Select|Wrap|Line Numbers
  1. =getVersion()
If you want to get tricky, you can use variables instead of constants:
Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3. Global gLongAppName As String
  4. Global gShortAppName As String
  5. Public Function getLongAppName() As String
  6.     getLongAppName = gLongAppName
  7. End Function
  8. Public Function getShortAppName() As Double
  9.     getShortAppName = gShortAppName
  10. End Function
  11. Public Function initDatabase() As Boolean
  12.     ' This code is to be run when the database first loads.
  13.     ' Called from an AutoExec Macro, or a Main Menu's OnLoad Event
  14.     gLongAppName = "The Long Name of your Application"
  15.     gShortAppName = "TLNA"
  16.     initDatabase = True
  17. End Function
  18.  
You can get even tricker if you want, by loading the Variables from values stored in a table. I can post an example of that if you need it.
Feb 18 '15 #2

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

Similar topics

0
by: Farooq Khan | last post by:
hi, my development team has been assigned a project that involves writing our own Web service. i happen to be a C++ programmer, new to C#/ASP.net. i dont know where to begin with......any...
2
by: Pavel Novotny | last post by:
H I'm trying to import a | seperated text from string variable which represents a tabl with several fields, eg 6124079|PRIRUBA 11 DN250 PN6;CSN131160.0;11369.1;CSN131005.50|KS|11,100000|3437,...
0
by: arunavlp | last post by:
hi, I am new to .net , i am using VB.Net (Web form). I dont know how to pass parameters to stored function. Regards, Arun.S
2
by: hojjatnikan | last post by:
please help me this code 62EH&5gx0wiqoQFw is this name ( Belux) but i dont know how convert it i dont know the algorithm of this code plead help me
2
by: Tiruak | last post by:
Hi there. Thanks in advance for the people reading and trying to help. I'm very begginer using flash and action script, and I tryed to do this one navigation menu. Since I dont have experience...
2
by: Sreenivas | last post by:
I dont know how to compile cpp programs with gcc as i am new to gcc and cpp. could anybody help me out? Thanks&Regards, Srinivas Reddy Thatiparthy.
2
by: shwetaT | last post by:
i m working in php domain and i dont know much about php,so will u plz suggest me some good sites through which i learn php very well n fast
8
risk32
by: risk32 | last post by:
Hi all. I have a really confusing problem. I'm using Swing and I'm trying to do a confirmation box : int reply; String message = "Do you want to input another number?"; String title = "Input...
2
by: sailormoon | last post by:
this information i put in data.txt 11221 MOHD IRFAN 80 70 11222 NURUL FITRAH 80 90 11223 MOHD FARHAN 70 80 11224 WAFFIN WARDAH 80 60 11225 SYAMSUL 50 50 99999 TAMAT 0 0 #include<fstream.h>
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.