Solved

Call tempvars in Access 2007

Posted on 2008-10-21
6
973 Views
Last Modified: 2012-05-05
Hello,

Probably the world's easiest question, but I cannot locate the answer... How do you call a TempVar in Access 2007???  I.e. if I create a dropdown menu, add logic to assign the selection to a tempvar, then open a new form, how do I echo the tempvar to see if it carried through?  I've tried to create labels, etc, but I cannot assign dynamic text to them.  

Access offers to "remember the selection" for future use, but remember it as what!  This program is a little too smart for it's own good I suspect...
0
Comment
Question by:south_paw
  • 3
  • 3
6 Comments
 
LVL 50

Expert Comment

by:Ryan Chong
ID: 22774143
you can try embed the values in OpenArgs parameter of the DoCmd.OpenForm method.

OpenForm Method
http://msdn.microsoft.com/en-us/library/aa141520(office.10).aspx

OpenArgs Property
http://msdn.microsoft.com/en-us/library/aa160845(office.10).aspx
0
 

Author Comment

by:south_paw
ID: 22774155
Hi thanks, but the field value is assigned to a "temp var" so surely I can call it on the landing page rather than passing it?
0
 
LVL 50

Expert Comment

by:Ryan Chong
ID: 22774201
Maybe you can store the value of "temp" into a temporary storage like a text file, xml, or in a table, so that you can retrieve that later. I don't think Access 2007 got concept of "session" as like what we usually did for web programming.
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

Author Comment

by:south_paw
ID: 22774217
Yeah, that's what I thought.  I was thinking either session variable or passing the data as a form variable.  Then I saw this page, which lists the below code.  It basically explains how to assign global variables.  There's instructions for calling, which I can't quite figure (i.e. how can you link a label to a macros):

http://www.archivum.info/microsoft.public.access/2007-12/msg02609.html



Public Function fnTempUser(Optional TempUser As String = "") As String
 
    Static myTempUser As String
    
    If Len(TempUser) > 0 Then myTempUser = TempUser
    fnTempUser = myTempUser
    
End Function
 
--------------------------
 
To call use: Call fnTempUser("MarkMarko")

Open in new window

0
 

Accepted Solution

by:
south_paw earned 0 total points
ID: 22774223
Disregard, I've solved it.

Cheers.
0
 
LVL 50

Expert Comment

by:Ryan Chong
ID: 22774246
global variables, ya, how can i forget that?! Sorry as I got many years not doing VBA programming these days and totally forget the concept of it...
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question