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
> Does An Open Form Know What Switchboard Item Opened It?, Access 2013    
 
   
ccIces
post Jul 11 2018, 02:06 PM
Post#1



Posts: 593
Joined: 28-August 02
From: Belle River, Ont, Canada


Or is it possible to pass the value along to a form?
I want to reuse a search form but I need to know which switchboard item called the form so I can then open the correct form from the selected search results.
On the switchboard, there are 2 options to open a search for based on what the user needs to do with the record it finds. The same search form is used to find the records and a transparent button is used to open the next form.
If I can set a hidden textbox that will carry a variable based on the switchboard option selected, then I can check that value and open the proper form.

Is there a way to pass that variable along from the switchboard?

switchboard -> choose option 1 or 2.
Search form opens and records whether option 1 or 2 was chosen.
Based on choice, new form1 or new form2 opens with selected record.
Go to the top of the page
 
BruceM
post Jul 11 2018, 02:15 PM
Post#2


UtterAccess VIP
Posts: 7,638
Joined: 24-May 10
From: Downeast Maine


You can use the OpenArgs argument of OpenForm to pass whatever value you like (the current form name or whatever) to the form being opened.

Or you could assign a value to a TempVar, which can be read anywhere within the application for as long as the application remains open.
Go to the top of the page
 
joemach814
post Jul 12 2018, 06:38 AM
Post#3



Posts: 46
Joined: 2-October 10



You could set a global variable that identifies which identifies which switchboard item opened it.
Go to the top of the page
 
ccIces
post Jul 12 2018, 11:33 AM
Post#4



Posts: 593
Joined: 28-August 02
From: Belle River, Ont, Canada


The switchboard manager uses a table to perform an action based on what was selected. One of the fields is Argument which contains the name of the form or report etc that it needs to open. The on -open event builds the switchboard options etc by reading the values. The on-click part of the macro uses the normal open form macro but supplies the values as the arguments loaded.
It does have an option for a Where statement. I think I should be able to build a WHERE SQL that reads the value of the label and sets the control on the form to a value?

No idea how that would be written though.

Go to the top of the page
 
BruceM
post Jul 12 2018, 01:42 PM
Post#5


UtterAccess VIP
Posts: 7,638
Joined: 24-May 10
From: Downeast Maine


I have never used the Switchboard Manager, and rarely work with macros. The best I can suggest is to add a new action to the macro: SetTempVar
Give it a name that makes sense to you (CalledFrom, or whatever), and for the Expression use ="Form name" or whatever you need to identify how the form was opened. That TempVar will be available throughout the application.

Go to the top of the page
 
ccIces
post Jul 12 2018, 02:20 PM
Post#6



Posts: 593
Joined: 28-August 02
From: Belle River, Ont, Canada


Perfect! Thanks you.
You can add a Set TempVars as a macro and I used the [Argument] value that was called to open the form name.
The only issue I had was reading the value. You have to specify [TempVars]![named variable]
Go to the top of the page
 
BruceM
post Jul 12 2018, 03:09 PM
Post#7


UtterAccess VIP
Posts: 7,638
Joined: 24-May 10
From: Downeast Maine


Glad to hear you got it working. Yes, that is one of several ways to read a TempVar value. Sometimes I wish there were fewer options smile.gif
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    23rd September 2018 - 01:38 AM