UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Str Variables In Event Code, Access 2010    
 
   
Brandi
post Feb 13 2018, 08:40 PM
Post#1



Posts: 1,666
Joined: 24-June 04



I have a form that helps me filter employees from a listbox.
UA has helped me create a dynamic query that selects the correct employees.

I created a copy of my form and am using it to filter employees for reporting purposes vs. my previous purpose.

My question is this.
Do the variables that are defined in the first form, hang on to their most recent value even after that form is closed?

Because my second form that I have created uses a modified version of the code from the first form but I am using the same variables and getting weird results.

Thank you.
Brandi
Go to the top of the page
 
theDBguy
post Feb 13 2018, 08:47 PM
Post#2


Access Wiki and Forums Moderator
Posts: 73,744
Joined: 19-June 07
From: SunnySandyEggo


Hi Brandi,

Variables can be declared different ways which could affect whether they will retain their assigned values or not. But typically, variables in Forms lose their values once the form is closed.
Go to the top of the page
 
GroverParkGeorge
post Feb 13 2018, 09:46 PM
Post#3


UA Admin
Posts: 33,945
Joined: 20-June 02
From: Newcastle, WA


I recently found that my understanding of variable declaration had gone stale, and needed to be updated.

Rather than rehash it here, I'll just link to a discussion that covers most of the relative topics, probably in more depth than you might want.
Go to the top of the page
 
Brandi
post Feb 14 2018, 11:39 AM
Post#4



Posts: 1,666
Joined: 24-June 04



They were variables in an event procedure of a form, so I would think they are just for that form and if another form uses the same code, I could see where it might get messed up if they are both open, but one is closed before another opens.
Thank you Grover. I read your thread and it did sound like there are various kinds of variables and I've decided trying to reuse variables is messy and I'm trying to do what I need to do by another approach.

Thank you all.

Brandi
This post has been edited by Brandi: Feb 14 2018, 11:41 AM
Go to the top of the page
 
GroverParkGeorge
post Feb 14 2018, 03:26 PM
Post#5


UA Admin
Posts: 33,945
Joined: 20-June 02
From: Newcastle, WA


Good choice. Public variables might be a bit tricky to manage.

George
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    17th November 2018 - 04:21 AM