Command function not working in Access 2007

P

Peter Rohlfs

I have and Access 2000 database that is used by multiple buildings.
In my Queries I would have a condition Command() and it would pull up the
records for the building passed by the / cmd in their shortcut.

Command is also used in event procedures.

When I try to run this database under Access 2007 it says the function
Command is undefined.

The help menu says the function is still there BUT it also has outdated
infromation about the northwind database (the path includes Office11 not
Office12 and then name isn't Northwind 2007).

I tried to create a public function to return the command:

Public Function Command1() As String
Dim MyStr As String
MyStr = "X"
MyStr = Command
Command1 = MyStr
End Function


The MyStr var is there so I could use a Watch on it.
Command sets Mystr to "" even though I had set Access
Options/Advanced/Command Line Arguments with some text.

When in a form's procedure I use Command I get the argument...
i.e. LblText.caption = Command in the form Load procedure sets the label to
the command line argument.

So I don't understand why Command doesn't work in the function.

I alos don't understand why it can't be used in Queries anymore.

Any suggestions/solutions would be appreciated.

Thanks,
Peter Rohlfs
 
D

Dirk Goldgar

What's your setting for Sandbox Mode? The Command() function works fine for
me, but I have Sandbox Mode set not to be used for Access.
 
P

Peter Rohlfs

Thanks for the answer.


Where is this sandbox setting and what does it mean?

Thanks,
Peter
 
D

Dirk Goldgar

Peter Rohlfs said:
Thanks for the answer.


Where is this sandbox setting and what does it mean?

Thanks,
Peter

See help topic HA01230190, which explains what Jet Sandbox Mode is and how
to set it to something other than its default, which is to block all unsafe
expressions everywhere. "Command()" is one of the functions considered
unsafe.
 
P

Peter Rohlfs

Dick Goldgar,

You are a genius!! The Sandbox setting was the problem.
It was a bit hard to find since we use Windows 2003 64 bit.

The key is located at
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\12.0\Access
Connectivity Engine\Engines

Thanks,
Pete Rohlfs
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top