Access 2003 Command Line /cmd xxx and Command()

M

Michael

I open a database with a command line ending ....... /cmd xxx or
......... cmd "xxx" or ..... ; xxx etc

I have a startup form and in the form open code I have



Dim abc as string

abc = command ' uses the command function which is supposed to the
return the value piped through the command line after /cmd

I expect the value "xxx" to be placed into abc. I get an empty string.

All the literature says that I should get "xxx".

What am I doing wrong?


TIA Michael
 
P

Pete D.

How about providing the actual command line, we don't know what it means but
it would be easier to provide you a answer if we could see the whole thing.
 
M

Michael

I have the following either as a shortcut target or in the RUN cmd box


"Z:\ABC\Administration\PQR Database\ABC_Progs.mdb" /cmd "Australia"

The statement open the database up to its startup form with or without any
command appendix.
I think that the quotes around "Australia" are irrelevant.

I have looked at all of the various pages on command line options - I have
used command lines for passwords, users etc many times.
Here I just want to pass over a parameter.


In the form open I have

Dim InputCountry as string

InputCountry = Command

This is a call to the Command() function, which should return the parameter
after /cmd (or ;).

I have found some comments that the Command function does not work for calls
from Office 2003 command lines and have followed through a dialogue which I
found between a User and a MVP, which did not seem to apply to code in the
OPENING, STARTUP nominated form.


TIA Michael
 
M

Michael

I have solved the problem - in an unsatisfying manner

For /cmd (and probably the other command line options) to work, you need to
actually EXPLICITY execute Access.

e.g. C:\....\msaccess.exe "Z:\.........................\abc.mdb" /cmd
abcdef

Whilst the ...mdb reference is sufficient to start the mdb, it does not seem
to allow command line options.

I looked at my other Access shortcuts where I use command line options and
they all explicitly execute msaccess.
This is a nuisance as in a multi workstation environment, you need to know
where each workstation keeps its version of the access program.

Michael
 
T

Tony Toews [MVP]

Michael said:
I have solved the problem - in an unsatisfying manner

For /cmd (and probably the other command line options) to work, you need to
actually EXPLICITY execute Access.

You are correct. That's a Windows limitation and nothing we have any
control over.
This is a nuisance as in a multi workstation environment, you need to know
where each workstation keeps its version of the access program.

There are registry keys available that will tell you what version of
Access is installed and the path. I use these in the Auto FE
Updater.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
M

Michael

Thanks for the extra info, Tony

Michael

Tony Toews said:
You are correct. That's a Windows limitation and nothing we have any
control over.


There are registry keys available that will tell you what version of
Access is installed and the path. I use these in the Auto FE
Updater.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
T

Tony Toews [MVP]

Michael said:
Thanks for the extra info, Tony

You're welcome. If you need the registry keys let me know and I'll
dig them up. That will, of course, only be helpful if you are calling
Access from another program and won't help on a client PC.

Well, unless you create the shortcuts programmatically which would
include the msaccess.exe, the target MDB/MDE and the command line.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 

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