473,403 Members | 2,354 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,403 software developers and data experts.

What is the scope of global variables in a shared front-end database?

beacon
579 512MB
Hi everybody,

[Access 2003]

I have a front-end database with a login form. When a user opens the database the login form loads at startup. When the user has entered his/her ID and password correctly, I store the user's name in a global variable that I add to tables to show who has updated the records.

I just implemented this yesterday, but I have a question that I didn't think to ask until now. If more than one user accesses the front-end, will the global variable be unique to the instance of the front-end that the user opens or will the variable change for each subsequent user that logs in?

So, if user A logs in and the global variable is set to "User A" and user B log in right after, will the global variable change to "User B" or will it stay "User A" in an instance of the front-end for user A and stay "User B" in an instance of the front-end for user B?

Thanks,
beacon
Mar 2 '11 #1

✓ answered by Lysander

Okay, if your database is split into a front end and a back end, then put a copy of each front end on each users PC and there is no problem.

As your users are accessing a front end that is on a network drive, I am not sure what would happen, I have never tried that.

Let me try to open two instances of one of my databases on the same front end, on the same PC and see what happens.

Okay, it works. I set a global variable to Mark on one instance and Dana on the other and both retained their values, but, I really would recommend putting the front end MDE on each PC. Apart from anything else, it will greatly improve the performance in loading forms etc.

8 3231
Lysander
344 Expert 100+
If each user has there own copy of the front end, on there own PC, then the global variable will be unique to each user. i.e. what you want it to be.

Since I can't see how two users can access the same frontend on the same pc at the same time, (after all, that is the whole point of having front and back ends) you don't have a problem
Mar 2 '11 #2
Lysander
344 Expert 100+
Ack, my mistake, did not read the title correctly. You say you have a 'shared' front end. How is this shared? Is the mdb on a server with multiple users accessing it at the same time?
Mar 2 '11 #3
beacon
579 512MB
Sorry Lysander, I didn't provide enough info. The users are accessing a front-end .mde. The front-end is on a network drive and the users access it using a shortcut to the .mde.
Mar 2 '11 #4
Lysander
344 Expert 100+
Okay, if your database is split into a front end and a back end, then put a copy of each front end on each users PC and there is no problem.

As your users are accessing a front end that is on a network drive, I am not sure what would happen, I have never tried that.

Let me try to open two instances of one of my databases on the same front end, on the same PC and see what happens.

Okay, it works. I set a global variable to Mark on one instance and Dana on the other and both retained their values, but, I really would recommend putting the front end MDE on each PC. Apart from anything else, it will greatly improve the performance in loading forms etc.
Mar 2 '11 #5
beacon
579 512MB
The database isn't overly large and there are only 15 or so people that use it, so performance isn't really an issue.

Thanks for testing that out. I would have done it, but I thought I would pose the question to see if anyone knew when, or if, the global variables would be reset if the same .mde was accessed by multiple people.

I guess, since the global variable is initiated on the front-end .mde instead of the back-end, the variable should be maintained throughout use of the front-end. At least, that's what I'm hoping for and the original reason for my question.

Thanks,
beacon
Mar 2 '11 #6
Stewart Ross
2,545 Expert Mod 2GB
Hi all. The front-end application is loaded locally on the user's PC, regardless of the file's location (whether on a network drive or on the user's PC itself). Global variables are allocated in local memory only and cannot be shared between machines, or indeed between multiple instances of the same database running on the same PC (as each runs in its own local memory space).

-Stewart
Mar 2 '11 #7
beacon
579 512MB
Thanks Lysander and Stewart.

I marked Lysander's answer as the best answer because it actually proved what I was trying to find out, although Stewart's answer explained what is actually happening with the variables. Too bad I can't mark them both as the best answer...
Mar 3 '11 #8
NeoPa
32,556 Expert Mod 16PB
Beacon:
will the global variable be unique to the instance of the front-end that the user opens or will the variable change for each subsequent user that logs in?
Essentially you're right on the button in that it is relative to the session, or instance the user is working with. The answers already given are both correct of course. I just wanted to clarify in the terms you yourself used in your OP.

Your conundrum about who to assign Best Answer to is also quite understandable. As far as we are concerned (if I may speak for my respected colleagues), as long as you assign it to a correct answer in a fair way, as you clearly have, then we all understand that there can only be one post that is so assigned, and are happy that a correct one has been at least. There are many threads with perfectly good answers that never get a post assigned at all. In as much as it matters at all to the individual expert, we all appreciate that a minority of correct answers get marked anyway. What I suppose I'm saying, in a somewhat roundabout way is, don't worry about it. We all appreciate that you've at least assigned a decent answer to your thread from those available :-)
Mar 4 '11 #9

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

Similar topics

10
by: Matt | last post by:
Greetings, What are people's thoughts on global variables in C++? Why are we taught not to use them in programming? Is it true that if you are running two copies of the C program one copy can...
8
by: lawrence | last post by:
I'm learning Javascript. I downloaded a script for study. Please tell me how the variable "loop" can have scope in the first function when it is altered in the second function? It is not defined...
1
by: MackS | last post by:
Hello everyone Consider the following two simple files. The first is my "program", the other a file holding some global variable definitions and code shared by this program and a "twin" program...
5
by: j | last post by:
Anyone here feel that "global variables" is misleading for variables whose scope is file scope? "global" seems to imply global visibility, while this isn't true for variables whose scope is file...
7
by: Michael | last post by:
Hi newsgroup, as the subject indicates I am looking for an advice using global variables. I am not if this problem is more about style then C. If its wrong in thi group, sorry. So I have a...
13
by: Sunil | last post by:
Hi all, I want to know how good or bad it is using global variables i.e advantages and disadvantages of using global variables. Sunil.
4
by: DaveM | last post by:
Although I've programmed for fun - on and off - since the mid 70's, I'm definitely an OO (and specifically Python) beginner. My first question is about global variables. Are they, as I'm starting...
44
by: fabio | last post by:
Why? i' ve heard about this, the usage of global vars instead of locals is discouraged, but why? thx :)
7
by: zeecanvas | last post by:
Hi, First of all: Yes, I know global variables are bad, but I've a huge amount of legacy code, and I've to maintain it _as_is_. I'm maintaining a big program. I moved all (program-wide scope)...
43
by: Kislay | last post by:
Which of the following is correct regarding the storage of global variables : 1. Global variables exist in a memory area that exists from before the first reference in a program until after the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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.