473,508 Members | 2,274 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to save variable values for future use?

I have a number of variables that need to be saved for later use. For
example, the path to be used for exporting files, options for creating
reports, interface preferences, saved search parameters, etc...

The obvious solution is to store this stuff in a table -- all I need is one
row in a very wide table.

I have more than one form in which these parameter variables are set. I set
the forms to "AllowAdditions = False" so the table stays at one row.

Are there other ways to accomplish this? What I'm doing seems like a
hack.... and I'm encountering problems when there is no data in the form --
it comes up blank because of the "AllowAdditions = False" setting.

Thanks in advance!
Nov 12 '05 #1
5 5941
Perhaps you could code _something_ as a default value for each of the
fields? That is, if the user has not modified it, use the directory in
which the database resides as the path for exporting; interface color
defaults to use Windows colors (which is not a bad idea, as users will be
used to that color scheme), etc. Then you won't have the case of the record
being all empty or non-existent.

Larry Linson
Microsoft Access MVP
"deko" <dj****@hotmail.com> wrote in message
news:H0*******************@newssvr25.news.prodigy. com...
I have a number of variables that need to be saved for later use. For
example, the path to be used for exporting files, options for creating
reports, interface preferences, saved search parameters, etc...

The obvious solution is to store this stuff in a table -- all I need is one row in a very wide table.

I have more than one form in which these parameter variables are set. I set the forms to "AllowAdditions = False" so the table stays at one row.

Are there other ways to accomplish this? What I'm doing seems like a
hack.... and I'm encountering problems when there is no data in the form -- it comes up blank because of the "AllowAdditions = False" setting.

Thanks in advance!

Nov 12 '05 #2
An alternate solution is a table with two fields:

tblVariable
VariableName PK
VariableValue

Set up a Get procedure to pass in the VariableName and send out the
VariableValue and a Let procedure to change them. You'll need to trap
nulls somewhere (either in the Get procedure or in the calling
procedure) to determine what to do if the VariableName has not yet
been initialized.

This a lot more flexible than your approach because it allows you to
add & delete variables without involving design changes.

There are other solutions involving saving to the registry, but that
never made much sense to me when a table would work just as well.

HTH

Tom

"deko" <dj****@hotmail.com> wrote in message news:<H0*******************@newssvr25.news.prodigy .com>... I have a number of variables that need to be saved for later use. For
example, the path to be used for exporting files, options for creating
reports, interface preferences, saved search parameters, etc...

The obvious solution is to store this stuff in a table -- all I need is one
row in a very wide table.

I have more than one form in which these parameter variables are set. I set
the forms to "AllowAdditions = False" so the table stays at one row.

Are there other ways to accomplish this? What I'm doing seems like a
hack.... and I'm encountering problems when there is no data in the form --
it comes up blank because of the "AllowAdditions = False" setting.

Thanks in advance!

Nov 12 '05 #3
hmmmm.... that might work....

It's interesting that you mention the Windows Registry. From what I
understand, that's what the Registry is all about -- a database of settings
for the computer. My guess is that if I re-write my application in C#, I'll
be using the Registry to solve these kind of problems.
"Tom Mitchell" <rt*****@swbell.net> wrote in message
news:70**************************@posting.google.c om...
An alternate solution is a table with two fields:

tblVariable
VariableName PK
VariableValue
Set up a Get procedure to pass in the VariableName and send out the
VariableValue and a Let procedure to change them. You'll need to trap
nulls somewhere (either in the Get procedure or in the calling
procedure) to determine what to do if the VariableName has not yet
been initialized.

This a lot more flexible than your approach because it allows you to
add & delete variables without involving design changes.

There are other solutions involving saving to the registry, but that
never made much sense to me when a table would work just as well.

HTH

Tom

"deko" <dj****@hotmail.com> wrote in message

news:<H0*******************@newssvr25.news.prodigy .com>... I have a number of variables that need to be saved for later use. For
example, the path to be used for exporting files, options for creating
reports, interface preferences, saved search parameters, etc...

The obvious solution is to store this stuff in a table -- all I need is one row in a very wide table.

I have more than one form in which these parameter variables are set. I set the forms to "AllowAdditions = False" so the table stays at one row.

Are there other ways to accomplish this? What I'm doing seems like a
hack.... and I'm encountering problems when there is no data in the form -- it comes up blank because of the "AllowAdditions = False" setting.

Thanks in advance!

Nov 12 '05 #4
Deko,
I think using a table is a better choice than using the registry.
Think of the occasion when someone restores the registry ... all your settings are gone?
When you use a table all your settings are IN the database. I guess you will have more control then.
It's interesting that you mention the Windows Registry. From what I
understand, that's what the Registry is all about -- a database of settings
for the computer. My guess is that if I re-write my application in C#, I'll
be using the Registry to solve these kind of problems.


I use a (local, because some settings may vary from one user to another) table
with only two fields and generic procedures called GetSetting(setting) and WriteSetting(setting).
In the past I used a one record-tabel with multiple fields, but I needed to update the tabledef to
often.

--
Hope this helps
Arno R



Nov 12 '05 #5
rkc

"deko" <dj****@hotmail.com> wrote in message
news:Fu*******************@newssvr25.news.prodigy. com...
hmmmm.... that might work....

It's interesting that you mention the Windows Registry. From what I
understand, that's what the Registry is all about -- a database of settings for the computer. My guess is that if I re-write my application in C#, I'll be using the Registry to solve these kind of problems.


What difference does a programming language make?
Will you be re-writing your application without a database?
If I had a mind to store settings somewhere other than in the database
the application uses, an .ini file or some kind of xml format would
be a choice before the registry.


Nov 12 '05 #6

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

Similar topics

4
25003
by: Andras Gilicz | last post by:
Hi VB fans I'm working on a relatively large project in VB6 with about a dozen forms, including graphs, labels, text boxes, etc. The software itself is actually a flow simulator with more or...
6
34036
by: Clay Beatty | last post by:
When you create database diagrams in Enterprise Manager, the details for constructing those diagrams is saved into the dtproperties table. This table includes an image field which contains most of...
3
1654
by: Jack | last post by:
Hi, I am trying to use the following code to make the save button invisible in the asp form when the checkbox is either on or the session variable has a particular value. THE CODE IS AS FOLLOWS:...
3
1674
by: Felix Kater | last post by:
Hi, normally I use a local variable assigned to different return values inside the function and return it like this: int f(){ int my_err_code; my_err_code=1;
41
3372
by: Mountain Bikn' Guy | last post by:
What is the current preferred way to save user preferences in dotnet? Is the registry the right place to do this? Can anyone recommend a good article (or book) for this topic? Thanks.
5
1171
by: Henry Wu | last post by:
Hi, I was wondering if I could save all of the controls in a tabcontrol for example, complete with the controls' name, text, value, position, size, etc.. Then when the user opens the application...
2
2475
by: prasanthag | last post by:
Hi, I am a newbie to this group. I have a problem in handling the variable arguments passed to a function. My requirement is like this. I have 2 functions say, void funcX(int i, int j);...
3
2498
by: prasanthag | last post by:
Hi, I am a newbie to this group. I have a problem in handling the variable arguments passed to a function. My requirement is like this. I have 2 functions say, void funcX(int i, int j);...
10
1794
by: ben | last post by:
is there anyway in c to write code that can variably make use of one of two structs (one that has 32 bit vals and the other that has 64 bit vals) throughout the code? i'm writing some code that...
3
1896
by: pradnya | last post by:
in my application, i want to save some values obtained from $_GET, and do not want to update these values on successive submit action. How to do this task ? I have already tried with ...
0
7229
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
7129
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
7333
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
7061
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
7502
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
5637
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
3194
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1566
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 ...
0
428
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.