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
> Boolean Declaration, Access 2013    
 
   
waitingroomz
post Jun 14 2019, 01:06 PM
Post#1



Posts: 81
Joined: 29-October 18



Situation:

I click a cmd and it sets a Public Boolean, Opens a new Form with a Primary Key in OpenArgs to a new form.

Once in the new form, the OpenArgs are set to determine which profile I am using.

I click a subForm in my new form and that event triggers something that I need the original Boolean for.

What are my options to reference the Boolean that was set at the beginning?

Thanks for any help.
Go to the top of the page
 
GroverParkGeorge
post Jun 14 2019, 01:15 PM
Post#2


UA Admin
Posts: 35,325
Joined: 20-June 02
From: Newcastle, WA


I would use a TempVar in preference to a Public Variable for this task.

That said, declare the Public Variable in a PUBLIC, stand-alone VBA module, not in a form module.

You can then ASSIGN A VALUE to the variable in the form module when you need to do so.

And later, you can retrieve the value from the Public Variable as needed.

Me.ThisValueIsNeededNow = booPublicVariableSetElsewhere

--------------------
My Real Name Is George. Grover Park Consulting is where I do business.
How to Ask a Good Question
Beginning SQL Server
Go to the top of the page
 
MadPiet
post Jun 14 2019, 01:16 PM
Post#3



Posts: 3,171
Joined: 27-February 09



Any reason you can't just reference it?

if m_blnSomeSetting = True Then
...
end if
Go to the top of the page
 
tina t
post Jun 14 2019, 02:00 PM
Post#4



Posts: 5,994
Joined: 11-November 10
From: SoCal, USA


well, you're dealing with three forms, and more to the point, three form modules, here: your original form, your "new" form, and the subform in the "new" form. if the boolean variable is declared in the same form module where you need to use it, then Piet's direct code will work fine. if not, then George's suggestion of a global variable declared in a stand-alone module, or a TempVar, is the easiest way to go.

hth
tina

--------------------
"the wheel never stops turning"
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    23rd July 2019 - 06:27 AM