473,385 Members | 1,326 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,385 software developers and data experts.

Allowing permanent, user set variables in Access 2002

92
I was wondering if there was a way to enable the user to set variables that remain set until the user changes them when desired, even after the database has been closed and the computer shutdown.

For instance, if you wanted the user to be able to specify where the Backup files were stored and not have to enter the address every time a Backup was made, similar to saving a document in Microsoft Word; once the location is set it isnt asked for unless the user wishes to.

I am aware that is a pretty loose comparison, as Word will have the original file to save over and therefore the address to save to.

I was just hoping there was a way to set the variable permanently, or at least to remember the address entered the last time and display that as the default along with a 'save' and 'browse' button.

Thanks,

NDayave
Jul 18 '07 #1
7 1979
Rabbit
12,516 Expert Mod 8TB
When you want to save something permanently you have to write it to non-volatile media. i.e. a hard drive, floppy, etc. But more specifically a file. In your case, just write it to a table where you keep permanent variables, you can lookup and update the table as needed through code.
Jul 18 '07 #2
NDayave
92
When you want to save something permanently you have to write it to non-volatile media. i.e. a hard drive, floppy, etc. But more specifically a file. In your case, just write it to a table where you keep permanent variables, you can lookup and update the table as needed through code.
Yeah, thats the solution I arrived at, is there no way to change the actual code so the Variable is set there, for example:

Var1 = "C:\My Documents"

Which can be changed by the user through the Forms:

Var1 = "C:\My Documents\Backup"

without the need for the user to manually edit the code, as this would save a lot of space and would probably require less work the next time a Permanent variable is required.

Thanks for the reply,

NDayave
Jul 18 '07 #3
Rabbit
12,516 Expert Mod 8TB
As far as I know, you can't change the coding through code. I think you and import code from a text file in which case you can change the text file that holds the code but that's just more convoluted than storing it in a file.
Jul 18 '07 #4
NDayave
92
As far as I know, you can't change the coding through code. I think you and import code from a text file in which case you can change the text file that holds the code but that's just more convoluted than storing it in a file.
Hmmm, okays thanks for your time anyway. I investigate urther, if i find an answer ill put it here.

Thanks again,

NDayave
Jul 18 '07 #5
ADezii
8,834 Expert 8TB
I was wondering if there was a way to enable the user to set variables that remain set until the user changes them when desired, even after the database has been closed and the computer shutdown.

For instance, if you wanted the user to be able to specify where the Backup files were stored and not have to enter the address every time a Backup was made, similar to saving a document in Microsoft Word; once the location is set it isnt asked for unless the user wishes to.

I am aware that is a pretty loose comparison, as Word will have the original file to save over and therefore the address to save to.

I was just hoping there was a way to set the variable permanently, or at least to remember the address entered the last time and display that as the default along with a 'save' and 'browse' button.

Thanks,

NDayave
I was wondering if there was a way to enable the user to set variables that remain set until the user changes them when desired, even after the database has been closed and the computer shutdown
You can write permanent (persisting) values to the System Registry. These values can be written, edited, and retrieved at will. You do not run the risk of anyone modifying these values since they are not stored internally,
Jul 18 '07 #6
NDayave
92
You can write permanent (persisting) values to the System Registry. These values can be written, edited, and retrieved at will. You do not run the risk of anyone modifying these values since they are not stored internally,
How would I go about doing that? Would it involve creating a new file that would be project specific, or is it more generic than that?
Jul 19 '07 #7
ADezii
8,834 Expert 8TB
How would I go about doing that? Would it involve creating a new file that would be project specific, or is it more generic than that?
This may not be exactly what you are looking for, but it is an alternative to consider as far as permanent storage goes:
Expand|Select|Wrap|Line Numbers
  1. Dim strPathToFile As String
  2.  
  3. strPathToFile = "C:\Test Directory\TestFile.txt"
  4.  
  5. 'To Save the File's Path to the System Registry. It will be saved in MyComputer\HKEY_CURRENT_USER\Software\VB and VBA Program Settings\Test Database\Text File Location
  6. Dim strPathToFile As String
  7.  
  8. strPathToFile = "C:\Test Directory\TestFile.txt"
  9.  
  10. 'To Save the File's Path to the System Registry 
  11. SaveSetting appname:="Test Database", Section:="Text File Location", _
  12.                      Key:="Absolute File Path", setting:=strPathToFile
  13.  
  14. 'To retrieve the File's Path and assign it to a variable
  15. strPathToFile = GetSetting(appname:="Test Database", Section:="Text File Location", _
  16.                 Key:="Absolute File Path", Default:="Path not stored")
  17.  
  18. MsgBox strPathToFile 'returns C:\Test Directory\TestFile.txt
  19.  
Jul 19 '07 #8

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

Similar topics

3
by: KemperR | last post by:
Hello Experts outhere, may be someone can tell me whats going wrong with my ADOX trial. I have an Access 2002 database with some tables and queries (views) The code listed below works well up...
6
by: CFW | last post by:
References in Access and .mdb files have always been painful for me - just when I thought I was OK in an .mdb, I have a .adp I'm working on and I need to use Set db as CurrentDb - Constant "object...
3
by: Melanie | last post by:
In AccessXP(A2000 mode), how do I make the change of references from ADO to DAO3.6 permanent? I go into references and uncheck ADO then scroll down to DAO3.6 and check it. I close references and...
7
by: jsale | last post by:
I'm currently using ASP.NET with VS2003 and SQL Server 2003. The ASP.NET app i have made is running on IIS v6 and consists of a number of pages that allow the user to read information from the...
0
by: Joe Schmoe | last post by:
I am working on an ASP.NET application that generates an Excel 2003 spreadsheet on demand for the user, containing much sales information, and then editable cells for the salerep user to enter...
3
by: Gary T via AccessMonster.com | last post by:
I have a couple of lulus here but I'll address the other one in "Queries". This one pertains to allowing users with read-only access to use the database whilst a person with admin access is using...
22
by: spam.noam | last post by:
Hello, I discovered that I needed a small change to the Python grammar. I would like to hear what you think about it. In two lines: Currently, the expression "x" is a syntax error. I suggest...
4
by: Gus | last post by:
We create reports in MSWord 2000 from within our Access 2002 application. The report template uses a lot of tables and nested tables. Over time, many hundreds of reports, Word has become...
14
by: chromis | last post by:
Hi, I've been trying to implement a more OOP oriented approach to dealing with user security on one of my websites, and I am trying to validate the user against an array of roles, however I am...
1
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.