Solved

Call tempvars in Access 2007

Posted on 2008-10-21
6
968 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 49

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 49

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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

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 49

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

948 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now