473,498 Members | 1,741 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access Class - preserve values

Hi
I have a class which I use to turn Admin mode on and off. There are in
different areas through access where I enable certain things if admin mode
is on. For example, if Admin Mode is on, then the Client code can be
changed.
I have some of the code below. I'm using an ADP so creating a temp table
isn't suitable.
What I'd like to do is preserve the value of bAdmin_Mode between instances.
I think this involves using Static somehow, but I can't figure out the
syntax.
Any help appreciated
Thanks
Vayse
' Class*************
Private bAdmin_Mode_On As Boolean

Public Property Get Admin_Mode() As Boolean
Admin_Mode = bAdmin_Mode_On
End Property

Private Property Let Admin_Mode(bNewValue As Boolean)
bAdmin_Mode_On = bNewValue
End Property

Public Sub TurnOn(stPass As String)

If Check_Password(stPass) Then
Admin_Mode = True
MsgBox "Admin Mode turned on", vbInformation
Else
MsgBox "Incorrect Password"
End If

End Sub

' Call like this ********************
Dim oAdmin As New clsAdminMode

oAdmin.TurnOn (Nz(Me.txtPassword, ""))
Sep 21 '06 #1
1 1313
So it's not security as such more user guidance yes?
(i.e. the values you persist aren't to be rigorously protected from a
dedicated poker?)
For a table persisted value wouldn't acomplish that - unless you were using
ULS - but since you're in an ADP...

Anyway - you could write a value to the registry.
Write to a textfile.
Set a property of the adp file.

I'm assuming be instance you're talking of application instances?
Or is this just instances of your class?

So when you create one object that is an instance of your class - you want
any further ones you open to pick up the same values (but not once you've
re-started)?
"Vayse" <va***@deadspam.comwrote in message
news:wn*******************@news.indigo.ie...
Hi
I have a class which I use to turn Admin mode on and off. There are in
different areas through access where I enable certain things if admin mode
is on. For example, if Admin Mode is on, then the Client code can be
changed.
I have some of the code below. I'm using an ADP so creating a temp table
isn't suitable.
What I'd like to do is preserve the value of bAdmin_Mode between
instances. I think this involves using Static somehow, but I can't figure
out the syntax.
Any help appreciated
Thanks
Vayse
' Class*************
Private bAdmin_Mode_On As Boolean

Public Property Get Admin_Mode() As Boolean
Admin_Mode = bAdmin_Mode_On
End Property

Private Property Let Admin_Mode(bNewValue As Boolean)
bAdmin_Mode_On = bNewValue
End Property

Public Sub TurnOn(stPass As String)

If Check_Password(stPass) Then
Admin_Mode = True
MsgBox "Admin Mode turned on", vbInformation
Else
MsgBox "Incorrect Password"
End If

End Sub

' Call like this ********************
Dim oAdmin As New clsAdminMode

oAdmin.TurnOn (Nz(Me.txtPassword, ""))

Sep 21 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
11048
by: Scott Morford | last post by:
I am developing a weed management database for the preserve I work on. One of the queries I'm working on will allow the user to run a query and see which weed patches have NOT been treated in the...
6
4707
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
5
7362
by: Colin Anderson | last post by:
I discovered, with great excitement, this article http://www.davison.uk.net/vb2notes.asp when researching methods for emailing from Access via Notes. Unfortunatly, when I run this I get a...
7
8819
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
11
6547
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
1
946
by: mm | last post by:
Hi all I have this class I copied this from this newsgroup and change this for my personal need When I run my program I get this First a candidate has been added via this AddHandler...
3
1583
by: Miro | last post by:
First off...thanks in advance for getting me this far. Sorry for all these class posts but im having a heck of a time here trying to get something to work, and have finally got it to work (...
4
2098
by: _MC_ | last post by:
Hi, I'm unable to access values in my Datagrid. Datagrid thinks it hase only 1 Cell. So here it is: The Datagrid is binded in PageLoad, AutoGenerateColumns is false, Columns are added on...
4
1936
by: Rose2007 | last post by:
Hi, I have a question regarding how to read a XML code from ACCESS. In my company there is a webpage that ask to enter the employee ID. After entering the ID automatically it gives all the...
0
7125
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
7002
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
7165
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,...
1
6885
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
7379
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
5462
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
4588
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3081
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1417
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.