Re: problem with a batch file wkgrp parameter
- From: "azpat" <u26545@uwe>
- Date: Tue, 12 Sep 2006 23:33:51 GMT
Just wanted to say Thank you! I learned so much! It's nice to have someone
who really knows there stuff. Just want you to know I appreciate your time
and efforts!!
Pat
Granny Spitz wrote:
I have posted several times trying to get help with attaching a database to
a mdw file.
Hon, you should have posted your question in the Microsoft Access newsgroups,
not the private Access forums you find on the web. The majority of Access
experts answer questions in the newsgroups, not those private web forums.
Most questions are answered here correctly within a few hours of posting, so
you could've saved yourself a week of wild goose chases if you'd come here
first.
What's wrong?
The short answer is you're using the wrong syntax in your batch file. You
did an excellent job on the code. It just needs two lines fixed, and then it
should work perfectly for you (unless you have to deal with Macro Security,
but that's a whole 'nuther barrel of monkeys).
The "START /MAX" command in the batch file tells the operating system, "Use
the default action, no matter what it is, on the file that follows the
executable." So the operating system finds that D:\Program Files\PC\PCtrlA.
mdb follows, and then checks the Registry, which happens to have C:\Program
Files\Microsoft Office\OFFICE11\MSACCESS.exe registered to open this type of
file. The default action for this executable on your operating system (and
almost everyone else's) is to open the file without any command line
arguments. Since you're currently joined to a workgroup information file
that isn't the secured workgroup information file used to secure the database,
the file is being opened with the default Admin user, who doesn't have
permission to open this secured database.
The good news is that if you can't open the database with the default Admin
user, it was probably secured properly (which isn't all that common of an
occurrence).
You need to remove the "START /MAX" command, but even then it won't work
correctly, because the LOCDIR variable contains double quotation marks and
this variable is being concatenated with a backslash and another variable
containing the file name to get the full path and file name with %LOCDIR%\%
PGRM%. Like this:
"D:\Program Files\PC"\PCtrlA.mdb
And you can't remove those double quotes, because that won't work correctly,
either. (Access will complain that Access doesn't recognize the command line
option, and it can't find D:\Program.mdb would be my guess, because a space
in the list of command line arguments means "the next string of characters is
going to be the next parameter.")
Does that mean you can't use a batch file for this task? No. It just means
you have to do extra work, hon, because you're stuck with a bad directory
name. To fix this batch file, create a new variable and assign the full path
and file name to it, like this:
SET LOCFIL="D:\Program Files\PC\PCtrlA.mdb"
And then change this line:
START /MAX %MSACC% %LOCDIR%\%PGRM% %WKGRP%
To this:
%MSACC% %LOCFIL% %WKGRP%
Save it and run your batch file.
.
- References:
- problem with a batch file wkgrp parameter
- From: azpat
- Re: problem with a batch file wkgrp parameter
- From: Granny Spitz via AccessMonster.com
- problem with a batch file wkgrp parameter
- Prev by Date: Re: problem with a batch file wkgrp parameter
- Next by Date: Re: Warning message
- Previous by thread: Re: problem with a batch file wkgrp parameter
- Next by thread: Re: Reset Security Utility?
- Index(es):
Relevant Pages
|
|