Solved

Call tempvars in Access 2007

Posted on 2008-10-21
6
985 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 52

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 52

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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 52

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

688 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