Solved

global variable for access reports

Posted on 2013-11-25
7
456 Views
Last Modified: 2013-11-25
I've inherited an access database.  it has lots of reports.  I have to make changes to some of the reports.  That changes I have to make are things like changing the names and titles of employees, like "Joe Smith, Director of Residential Service".    This is currently hardcoded in the reports.  Is there an easy way to feed this data from an access table or a global-type variable, so that the next time I only need to change the data in one place?
0
Comment
Question by:HLRosenberger
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 4

Assisted Solution

by:AccessGuy1763
AccessGuy1763 earned 125 total points
ID: 39674741
Yep!  You just need to declare them in a global Module.

If you have one already, you can put the global variables there or you can open the VB Editor and do Insert > Module.

Although it's not required, global variable declarations typically are found at the top of the Module, above any global functions or subroutines in the same Module.

So your declaration for the above variable might look like this:
Dim strDirOfResServ as string

Then you can set it in the same global module or anywhere else, since it's global:
strDirOfResServ = "Joe Smith, Director of Residential Service"

Now the part that might be a little tricky is that I think you'll need to use code to set the captions:
me.lblDirOfResServ.Caption = strDirOfResServ
0
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 125 total points
ID: 39674743
you need to create a table with the names and title of the people.
tblPeople
ID
Name
Title

use at least three fields as mentioned above
0
 
LVL 61

Assisted Solution

by:mbizup
mbizup earned 250 total points
ID: 39674745
If this is a  titles/heading,  for your reports you can include it in a table and use the following as a controlsource property:

 = DLookup("HeaderInfo", "YourTable")


However, if you have an employees table and their positions/title are included in the employeeInfo table you might be able to work that information into the recordsource query of your report.
0
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
LVL 1

Author Comment

by:HLRosenberger
ID: 39674947
For all 3 of these ideas, how do I then reference the data/field/variable inside the reports, in a simple label object?
0
 
LVL 61

Accepted Solution

by:
mbizup earned 250 total points
ID: 39675026
Use a textbox instead of a label.  The DLookup syntax goes in the Control Source property, including the = sign like this:



 = DLookup("HeaderInfo", "YourTable")
0
 
LVL 61

Expert Comment

by:mbizup
ID: 39675031
Any of these ideas would use textboxes, I think.  The textbox control source gives you more flexibility than the caption property of a label.
0
 
LVL 1

Author Closing Comment

by:HLRosenberger
ID: 39675041
Thanks!
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

705 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