Using Command causes failure in Access 2000 runtime

J

Jason W. Peak

I've got a AutoExec macro calling a function named CheckCommandLine.
All's well and good if I just throw a line in that function like
'DoCmd.OpenReport "rptForecastAtRepLevelDollars"'. It works on the
machine I'm developing on as well as the machine I'm deploying to.
Now here comes the problem. The second I throw in a line referencing
Command (should grab the command-line argument passed by /cmd per MS
docs), it works on my development machine but bombs on the target
machine. For example, I threw in the following test:

Function CheckCommandLine()
If Command <> "" Then
DoCmd.OpenReport "rptForecastAtRepLevelDollars", acViewPreview
Else
DoCmd.OpenReport "rptForecastAtCustLevelDollars",
acViewPreview
End If
End Function

As soon as this test against Command was put in, it bombed on the
client machine...still works on the development machine though. It
should run one of the two reports, regarless of whether anything is
passed in or not. It just gave the following error messages:

Action Failed
Macro Name: AutoExec
Condition: True
Action Name: RunCode
Arguments: CheckCommandLine

Execution of this application has stopped due to a run-time error.
The application can't continue and will be shut down.

Then it just exited Access when I hit ok. Removing everything but one
of the DoCmd lines (tested it with both singularly) results in the
correct report running in preview mode on the target machine.
 
G

GVaught

Most likely the client machine missing some references that are on your
development machine. Check your references on the development machine and
compare them to the Client's machine. Open the database on the client's
machine holding down the 'shift' key to bypass any opening code. Once you
show the database window. Open any module in design view or click on a form
and click on the Code icon. Check Tool | References once you are in the
'code editor' window. Look for MISSING on any checked boxes. Uncheck the
Missing box and then locate the MISSING reference from the list below.
Example: Your development machine uses DAO 3.6, but your client only has DAO
3.51. You need to find DAO 3.6 in their listing below and check it. This
also might require re-registering the dll on the Client's machine.

If they are missing an Active X Control and you are using Access 97 then you
may have to register that Control on the Client Machine.

Hope that helps!
 

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