Solved

Call tempvars in Access 2007

Posted on 2008-10-21
6
967 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
Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

 

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

760 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

22 Experts available now in Live!

Get 1:1 Help Now