Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / November 2006

Tip: Looking for answers? Try searching our database.

Persisting public variables

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John F - 09 Nov 2006 02:54 GMT
Is there a simple way to save the contents of public variables after the
session is over?  I can store the information in a table, but was wondering
if there is a more direct way to persist the variables.

Thanks,

John
BruceS - 09 Nov 2006 03:00 GMT
John,
When the program unloads, the memory that holds the variables is released.  
You have to use a table, or a .ini file.  I find the former easier.
Bruce

> Is there a simple way to save the contents of public variables after the
> session is over?  I can store the information in a table, but was wondering
[quoted text clipped - 3 lines]
>
> John
John F - 09 Nov 2006 05:09 GMT
Bruce,

Thanks for the reply.  I will check out the ini file approach but will
probably use a table.  

My intent to persisting information is to maintain client-specific
preferences.

Seems one drawback to using a table is if I convert to an Access Project at
some point, this table will have to go on the server shared by all clients
instead of local to a single client.  I will have to do some redesign to have
multiple records in the table correspond to different users.

Thanks again,

John

> John,
> When the program unloads, the memory that holds the variables is released.  
[quoted text clipped - 8 lines]
> >
> > John
Damian S - 09 Nov 2006 05:12 GMT
If you think it might head that way in the future, why not plan for that now
while you are implementing it?

Damian.

> Bruce,
>
[quoted text clipped - 25 lines]
> > >
> > > John
John F - 09 Nov 2006 05:48 GMT
Valid point.  But that involves designing a log in system or other way to
identify individual clients to point to a specific record in the table.  What
is best in that environment is pretty speculative at this point, so not sure
if just a simple approach best for now.  Something to think about.

> If you think it might head that way in the future, why not plan for that now
> while you are implementing it?
[quoted text clipped - 30 lines]
> > > >
> > > > John
Merle Nicholson - 09 Nov 2006 05:55 GMT
You can keep client-specific values in local Access tables and migrate common
tables to the server. For settings, I usually set up a 'parms' table with two
columns; key name and value, and then write two small "SaveParm(key, value)",
"GetParm(key, value, default_Value_If_Null)" subroutines to manage them.
Signature

Merle Nicholson
Application Developer
Access, VBA, VB.NET

> Bruce,
>
[quoted text clipped - 25 lines]
> > >
> > > John
John F - 09 Nov 2006 11:38 GMT
Right now I have all the tables linked and use a different file for the data.
But I thought when converting to an Access Project, that no local data
tables exist any more and that all tables are on the server.  Is that not
correct?

> You can keep client-specific values in local Access tables and migrate common
> tables to the server. For settings, I usually set up a 'parms' table with two
> columns; key name and value, and then write two small "SaveParm(key, value)",
> "GetParm(key, value, default_Value_If_Null)" subroutines to manage them.
Stefan Hoffmann - 09 Nov 2006 11:54 GMT
hi John,

> My intent to persisting information is to maintain client-specific
> preferences.
> Seems one drawback to using a table is if I convert to an Access Project at
> some point, this table will have to go on the server shared by all clients
> instead of local to a single client.  I will have to do some redesign to have
> multiple records in the table correspond to different users.
You can store it in a global table, e.g.

  CREATE TABLE dbo.Settings (
    ComputerName VARCHAR(64) NOT NULL,
    UserName VARCHAR(64) NOT NULL,
    ParamName VARCHAR(64) NOT NULL,
    ParamValue VARCHAR(64) NOT NULL,
    CONSTRAINT PRIMARY KEY (ComputerName, UserName)
  )

mfG
--> stefan <--
John F - 09 Nov 2006 13:38 GMT
Stefan,

Thanks very much.

John

> hi John,
>
[quoted text clipped - 16 lines]
> mfG
> --> stefan <--
Klatuu - 09 Nov 2006 15:47 GMT
Why has no one suggested creating application level properties?
Look at CreateProperty in VBA Help.

Once a value has been established for an application property, it remaing
presistent until changed via code.  It is almost identical to using Public
variables except they don't lose their value when the mdb is closed.

> Stefan,
>
[quoted text clipped - 22 lines]
> > mfG
> > --> stefan <--
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.