[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

memory variables and form display questions

Posted on 2013-02-07
3
Medium Priority
?
240 Views
Last Modified: 2013-02-08
Hello Again
Thanks so much for all the help getting me up to speed with access. I do have two questions which I hope can be answered.
1. How do you store memory variables in access. I remember DBASE III had a "STORE MEMORY TO <filename>" where the information was stored on a file  which could be retrieved at a later time or date.

2. When creating a form using a table that has two fields in it. If I want to display both fields yet only allow change on one of the fields how would this be done? In the access form?
0
Comment
Question by:PawloA
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
3 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38865899
<I do have two questions which I hope can be answered.>
The rules of the site only allow one distinct question per post...

There are many ways to store variables, ...also "Scope" needs to be considered.

In a Sub you can do this:

Dim lngCustID as Long
...to "create" a variable to be used only in that sub

Then you can load it from a form control:
lngCustID =Me.txtCustID
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38865919
If you nned a variable to "persist" throughout a "Form" (Module)
then you can do something like this( In the Form's code Module:

Private lngpvtCustID as Long

Sub Form_Open(Cancel As Integer)

    lngpvtCustID =me.txtCustID
End sub


Then you can also grab this variable in another sub in the same form:

sub YourButton_Click()
msgbox lngpvtCustID
end sub
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 2000 total points
ID: 38865944
To make a Variable persist through your entire application you have to create a Code Module.
Then do this:

Public lngpubCustID as long

Then you can set/Get this value form anywhere in your app..

But therein lies the danger.
You really need to have one place in your app where Public variables are set and reset, otherwise you will tie yourself in knots trying to figure out what the value is and how/where it was set...


In any event...
None of these variables will persist when the DB is closed though.

To do this you would load the values into a table..
...but this is another topic entirely...

Hope this all helped...

Lets see if other Experts can flesh out (or correct/clarify) the skeleton I sketched here...

;-)

JeffCoachman
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question