Link to home
Create AccountLog in
Avatar of kperelman
kperelman

asked on

access 2007 macro conditional expression error

I have a MS Access 2003 application that I want to open (unconverted from access2003) using Access 2007.  

A problem occurs when my macro hits the line where there is a conditional expression command()="" .. I get the message 'the expression you entered has a function name <appl> cant find'?  It does not like the reference to command() but the command() works if I use it in a VBA module.  Also, if I remove the conditional expression the macro runs fine.  The macro runs fine under access 2000, 2002 and 2003.  

What is the problem Access2007 is having and how do I solve it?
Avatar of Markus Fischer
Markus Fischer
Flag of Switzerland image

I don't have Access 2007 here, but I believe that the Command() function is not available in so-called "sandbox mode". Some functions are no longer available for the JetEngine and for macros. I'm guessing that is your problem.

I see two workarounds:

1) Get rid of the macro and use VB instead. For a start, you can copy-paste your macro as a module; this will convert your macro to simple VB code.

2) Create a wrapper function in a global module:

Public Function CommandLine() As String
    CommandLine = Command()
End Function

And use that instead in your macro.

Cheers!
(°v°)
Avatar of kperelman
kperelman

ASKER

Thanks for the quick reply ..

I was hoping for a more definitive documented explanation .. ie: something that specifically says the command() function in macros is no longer supported as well as these other features .. I have not found such info in my searching.  Access2007 implies the access2003 application should work unconverted so is the command() not supported or did I find a bug .. I have encountered similar undocumented macro 'bugs' in the past?  

Also documentation about this .. and other such changes/info .. would allow me to be pre-emptive and prepare/know what I need to change in my application before I encountered the issue(s).

Any further info would be appreciated.

Thanks.

Keith
 
ASKER CERTIFIED SOLUTION
Avatar of Markus Fischer
Markus Fischer
Flag of Switzerland image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Thanks for the info .. that's what I was looking for.

Keith