Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HI, I HAVE A PUBLIC VARIABLE ON A

Status
Not open for further replies.

aqm

Programmer
Aug 26, 2002
65
0
0
AO
HI,
I HAVE A PUBLIC VARIABLE ON A MODULE AND I GIVE A VALUE TO THE VARIABLE ON THE FIRST FORM, WHEN I OPEN THE SECOND FORM, I CLOSE THE FIRST FORM, AFTER THIS THE VARIABLE GOES NULL. I HAVE THREE FORMS. OPN THE FIRST FORM, I ATRIBUTE A VALUE TO A VARIABLE WHICH WAS DECLARED AS PUBLIC ON THE MODULE. WHEN I OPEN THE SECOND FORM, I CLOSE THE FIRST AND I USE THE VARIABLE WITYH ITS CONTENTS NORMALLY.WHEN I OPEN THE THIRD FORM, I FIND THAT THE VARIABLE IS NULL. I HAVE ALREADY MADE A TEST BY LEAVING THE FIRST FORM OPEN. IT WORKS. NOW, HOW , WHERE CAN I DECLARE A VARIABLE THAT I CAN REFERENCE TO EVEN AFTER THE FORM HAVING BEEN CLOSED.
HELP
AQM
 
You should be able to reference a variable on a module all the time, if I'm thinking correctly, if it's declared public. Perhaps you should check the code of the close event of your form to see if that does something with the variable. Good luck.

Niki. --------------------------------------
It's not the monsters under your bed, it is the men next door.
That make you fear, make you cry. Make you cry for the Child.
All the wars are fought amongst those lonely men. Unharmed, unscarred.
 
Make sure that the Public variable is declared in a Code Module, not in the Class Module associated with a form.
 
HI,
THE PUBLIC VARIABLE IS DECLARED ON THE CODE MODULE. EVEN THOUGH NOTHING HAPPENS. WHAT CAN I DO?
AQM
 
You may have a scoping problem. Make absolutely sure you aren't using the same variable name in one of your form modules. If you are, this would explain things.

Chris
 
Hi AQM!

My advice would be to not use a public variable at all. Open a form in hidden mode and drop the information you need in a text box on the form. Then close the form when you exit Access.

hth
Jeff Bridgham
bridgham@purdue.edu
 
HI,
HOW CAN I DESABLE A MOUSE SCROLL?
PLEASE HELP.
AQM
 
Hi AQM!

Check out Microsoft KB Article ID: Q278379.

hth
Jeff Bridgham
bridgham@purdue.edu
 
Well, it looks like you're getting responses here, but nevertheless, I have to say that I would never answer a post written in all caps. It's hard to read, and, by netiquette, is considered shouting.

We all have questions that are important to us. Shouting isn't necessary.

Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access databases since 1995.
 
hi,
sorry jeremy, i didn´t know that wriing with cap is shouting. would please help to this?

aqm
 
Try this

In the module for the form,

PublicVairiable = Me.Controls(tovars).Value

tovars is the name of the textbox.
 
Oops, I think that may be a solution to a different problem. Tovars is a variable which contains the name of the textbox. I don't think this is the solution to your problem. Please accept my apology.
 
For Years I have been looking for a good way to do this. How are you using a form to change the value of a variable? Bill Cooper
I/O Com, Ltd.
Newark, Ohio
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top