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

Global Variables Reset on Error

Hello All,

I have an issue with an Access 2003 ADP file hooking up to SQL Server 2005.

I had a global variable in a module like the following:

Public loginUserName As String

I found out that upon errors, the value for this variable gets reset. So, after some initial online research, I changed this variable to a property in a code module:

Public Property Let UserID(strUID As String)
mstrUID = strUID
End Property

Public Property Get UserID() As String
UserID = mstrUID
End Property

That seemed to work initially when combined with a generic error handler that is used to log all errors.

I've just recently been notified by the Client that the value from "UserID" is still getting flushed out -- but mainly on "timeout expired" errors.

Is there a way (with fewer resources used as possible) to maintain these "global" values upon errors/timeouts?

Thanks!!
Dec 3 '08 #1
3 2889
FishVal
2,653 Expert 2GB
Hello, Xanfere.

To the best of my knowledge, when error has been handled and cleared via some kind of Resume statement, global variable are not destroyed.

Regards,
Fish.
Dec 3 '08 #2
I did a workaround...

Upon successfully logging into the app, I write the values to a text file (in the same folder as the .adp file). Then, if any of these values are blank when I access it, I just read in the values from the text file and refresh the custom properties.

So far, it seems to work fine...
Dec 3 '08 #3
ChipR
1,287 Expert 1GB
You could also store the values not visible on a form or on a hidden form, or just call the function to get the user name anew any time you need it and it's blank, rather than use the text file.
Dec 3 '08 #4

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

Similar topics

8
by: Mike Turco | last post by:
This is a strange one. I have an app that needs to know who is using the program but there's no need for security. When the program opens a form comes up with a listbox. The user double-clicks...
17
by: MLH | last post by:
A97 Topic: If there is a way to preserve the values assigned to global variables when an untrapped runtime error occurs? I don't think there is, but I thought I'd ask. During development, I'm...
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.
8
by: Giorgio | last post by:
Hi all, i have a problem with a website where i use asp 3 and a global.asa in the root. In global.asa i use some aaplication variables which contains strings, such as: Application("str1")="text"....
9
by: CDMAPoster | last post by:
About a year ago there was a thread about the use of global variables in A97: http://groups.google.com/group/comp.databases.ms-access/browse_frm/thread/fedc837a5aeb6157 Best Practices by Kang...
23
by: David Colliver | last post by:
Hi, using c#, 1.1 I know that we are not supposed to use global variables etc. in c# I am having a problem, but not sure how to resolve. I did have another post here, but may have over...
24
by: onnodb | last post by:
Hi all, Currently, I'm working on an Access XP database app that uses two global objects in its code. These two objects are instances of "controller classes". For example, one of them manages...
20
by: teddysnips | last post by:
Weird. I have taken over responsibility for a legacy application, Access 2k3, split FE/BE. The client has reported a problem and I'm investigating. I didn't write the application. The...
14
by: ramprat | last post by:
Hi All, I currently need to store 3 variables to be used as global variables throughout my application. I need to record the username, their employee group and the task they are doing. The...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.