Fabrice Lambert
asked on
Command line troubles
Hi,
When launching an access database from the command line, one of my user experience a weird behavior.
The database is supposed to recieve a command line like the following (value returned by the Command() function):
import="291" database="C:\Users\userNam e\My documents\Application_DATA .accdb"
But he recieve:
import= 291 database= C:\Users\userName\My documents\Application_DATA .accdb
Quotes are stripped, and an additional space is inserted right after the "=" sign (or quotes are replaced by a space).
Do you see anyhing that can explain this behavior ?
When launching an access database from the command line, one of my user experience a weird behavior.
The database is supposed to recieve a command line like the following (value returned by the Command() function):
import="291" database="C:\Users\userNam
But he recieve:
import= 291 database= C:\Users\userName\My documents\Application_DATA
Quotes are stripped, and an additional space is inserted right after the "=" sign (or quotes are replaced by a space).
Do you see anyhing that can explain this behavior ?
Is it shortcut, cmd file, copy/paste to command line? Could you show full string?
ASKER
The command line comes from a batch:
"C:\Program Files (x86)\Microsoft Office\Root\Office16\msaccess.exe" "C:\Users\userName\My documents\Application_PRG.accdb" /cmd import="291" database="C:\Users\userName\My documents\Application_DATA.accdb"
The database is opened fine, but the code parsing the command line fail because the value returned by the Command() function does not have the expected pattern.
Quotes in command line means it is text part and it will be delivered without quotes.
I don't believe it is working anywhere.
Try
/cmd "import=291" "database=C:\Users\userNam e\My documents\Application_DATA .accdb"
from command you should get two parameters:
import=291
and
database=C:\Users\userName \My documents\Application_DATA .accdb
I don't believe it is working anywhere.
Try
/cmd "import=291" "database=C:\Users\userNam
from command you should get two parameters:
import=291
and
database=C:\Users\userName
ASKER
@als315: Afraid not. As I stated, I recieve the command line as expected, but one user don't.
From my knowledge, Access is supposed to forward the whole string following the /cmd argument untouched.
And the Command() function return a string, not a container.
From my knowledge, Access is supposed to forward the whole string following the /cmd argument untouched.
And the Command() function return a string, not a container.
I can't test your command now, will do it later today, but Access can get more then one parameter, divided by space, like this:
/cmd "Parm1" "Parm2"
You can try:
/cmd "import=""291""" "database=""C:\Users\userN ame\My documents\Application_DATA .accdb"""
/cmd "Parm1" "Parm2"
You can try:
/cmd "import=""291""" "database=""C:\Users\userN
I don't understand also why you need quotes around parameter
May be this is correct:
/cmd "import=""291"" database=""C:\Users\userNa me\My documents\Application_DATA .accdb"""
/cmd "import=""291"" database=""C:\Users\userNa
ASKER
The issue is:
Why on one computer the command line is forwarded intact, and why on the 2nd computer it is not.
Notes:
Applications recieve command line as string, quotes are here to handle spaces. It is up to their parsing functionality to tanstype values or do whatever they want with it.
Why on one computer the command line is forwarded intact, and why on the 2nd computer it is not.
Notes:
Quotes in command line means it is text part and it will be delivered without quotes.This is false.
Applications recieve command line as string, quotes are here to handle spaces. It is up to their parsing functionality to tanstype values or do whatever they want with it.
Anything different about the machine? Like a different language, etc?
Can you try logging into that machine as a different user and see if the same behavior exists? If it does not, then try logging in as the "trouble" user on a different machine - does the behavior follow the user?
I ask because I had a similar experience many years ago with an Access database and the Command function, and traced it down to a bad user profile. I'm not sure how the user profile has anything to do with that, but once I created a new user profile, the issue went away.
Can you try logging into that machine as a different user and see if the same behavior exists? If it does not, then try logging in as the "trouble" user on a different machine - does the behavior follow the user?
I ask because I had a similar experience many years ago with an Access database and the Command function, and traced it down to a bad user profile. I'm not sure how the user profile has anything to do with that, but once I created a new user profile, the issue went away.
ASKER
User is somewhat busy today, we'll try tomorow (me logging on his computer and vice-versa).
Sorry, Fabrice, I was wrong, you were correct. New knowledge, thanks. Never see before that you can't send 2 parameters one by one:
/cmd "Param1" "Param2"
but
/cmd i="Param1" j="Param2"
is possible.
Looks like there is some undocumented interpreter.
/cmd "Param1" "Param2"
but
/cmd i="Param1" j="Param2"
is possible.
Looks like there is some undocumented interpreter.
ASKER
Well, no luck with logging on his computer.
No explanations still, I suspect something on computer's environent (go figure what with limited privilèges).
Doubling double quotes fixed the issue, even tho, I do not like it because we have an heterogenous command line.
No explanations still, I suspect something on computer's environent (go figure what with limited privilèges).
Doubling double quotes fixed the issue, even tho, I do not like it because we have an heterogenous command line.
I'd agree with the environment issue, and with things like this you'll have a hard time sussing it out.
An Office repair or reinstall may resolve the issue, but that would be a last-ditch effort.
An Office repair or reinstall may resolve the issue, but that would be a last-ditch effort.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.