Link to home
Start Free TrialLog in
Avatar of PawloA
PawloAFlag for Canada

asked on

memory variables and form display questions

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?
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

<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
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
ASKER CERTIFIED SOLUTION
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial