Solved

Call tempvars in Access 2007

Posted on 2008-10-21
6
977 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 51

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 51

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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

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 51

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

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…
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
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 …
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…

749 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