[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

global variable for access reports

Posted on 2013-11-25
7
Medium Priority
?
465 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 500 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 500 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 1000 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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 1000 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

656 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