Error in RunTime - settempvar is not available

David S

Registered User.
Local time
Today, 08:01
Joined
Jan 6, 2012
Messages
11
Hi – I am relatively new to Access and am using Access 2010 macros in my database. The db works well [it seems?] when running on my ‘full’ version of Access 2010.

However an error occurs when I attempt to run the same db on either:
a) A PC running Access RunTime , or
b) When the db is compiled into an executable – i.e. make ACCDE [Through ‘Save & Publish’]

The error message when running (a) or ( b) is “settempvar is not available etc..”

My theory is it is the same error cause? May be (a) or ( b) are the same in that the software is converting my macro code to vb and it is the vb that is in error - but please feel free put me right on this ?
To test my theory I used the Access provided ‘Macro to vb converter’ to convert one of my Macros to vb and found that this new vb code errors, whereas the Macro does not?

I think I have narrowed one of the problems down to where I assign a TempVar to equal an existing TempVar. – see example attached- The converted VB is in error – see message in the attached.

I hope the attached example is sufficient for you to provide some advice and guidance which would be very gratefully received. Many thanks in anticipation..
Rgds David
NB Surely it will not be an error in the Microsoft provided ‘converter’ ?
 

Attachments

Sorry but I have wasted your time with the above. On further research I have found that “The value to store as a TempVar must be a string expression or a numeric expression. Setting this argument to an object data type will result in a run-time error.”

Obviously, where I have Macro code that sets a TempVar to equal an existing Tempvar, the [automatic] Macro to vba conversion is producing the incorrect vba syntax!

e.g. I have macro code “Set TempVar Test = 9999 followed by Set TempVar Test1 = [TempVar]![Test]”. This converts in vba to “TempVars.Add "test1", TempVars!test “ - which is not a numeric or string expression.

In my naivety I thought all Macro code would compile/convert correctly. My problem is I have used Macros extensively in my database and I now [belatedly] find I cannot use such in RunTime – ho hum!
My challenge now is to learn vba so I can debug my Macros when they are converted/compiled. (I really thought Microsoft would have provided further help on these sort of compile problems for saps like me!).

Could anyone possibly steer me on the correct Macro coding for the above example ( so it converts correctly), or failing that, the correct vba to avoid the (above) TempVars.Add error?
Many thanks. David

NB I have used the acronym "vba" and not "vb" in the above, but do not know which is correct in this case. Sorry again.
 

Users who are viewing this thread

Back
Top Bottom