32538 Tempvars can only store data..

sgrace

Registered User.
Local time
Today, 15:48
Joined
Dec 13, 2011
Messages
22
Hello all.

Using Access 2010. Trying to convert global variables into Tempvars. The first set of globals I converted work fine. I refer to them in code as so:

Code:
    TempVars!lngProviderProgramAutoID = Nz(Me.PRV_PGM_AutoID_Programs, 0)
And similarly:

Code:
    TempVars!stTeamMember1 = Nz(DLookup("PGM_TeamMember1", "tbl_Programs", "PGM_AutoID_Programs = " & TempVars!lngProviderProgramAutoID), "")

Everything works fine. But when I converted more globals to Tempvars, all of a sudden started receiving runtime error 32538 - TempVars can only store data. They cannot store objects.

Here's example code:

Code:
    TempVars!stCallingForm = stCalledForm
stCalledform is dim as string. It's not an object. And this is only one of several string variables that have received the error.

I've tried decompile/recompile, thinking it must be an anomaly. But can't get rid of this error.

Any insights/assistance much appreciated.
 
I have not used TempVars before, but a simple Google search led me to this..
Code:
TempVars.Add "stCallingForm", stCalledForm
As it seems,
Access 2007 Programming by Example with VBA said:
Notice that to create a temporary variable all you have to do is specify its value. If the variable does not exist, Access adds it to the TempVars collection. If the variable exists, Access modifies the value.
 
Yes, thanks. I've seen and tried that syntax. It didn't work either. Same error.

The reason I'm using the other syntax is that I saw it in 'Microsoft Access 2010 Programmer's Reference' (book) and it allows for a quick search/replace of global variables.

It worked for the first several variables I tried. When I started getting the error message, I tried the .add syntax instead (that you mention) but resulted in the same error, 32538.
 
Wow, this is pretty old post but all post deserves an answer... this worked for me:

TempVars.Add "stCallingForm", Nz(stCalledForm)
 
I don't really understand why a developer would feel compelled to change the Global Variables to TempVars in a functioning database.

Indeed I have yet to see a good reason to change from mdb to accdb even though I am now working with Access 2010.

If they are converting to using a web based system would be one reason but I get the impression that some make the change simply because they have moved to the later version of Access.

Runtime 2010 seems to run mdb files without any problems.
 

Users who are viewing this thread

Back
Top Bottom