Re: problem with a batch file wkgrp parameter



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.

.



Relevant Pages

  • Re: problem with a batch file wkgrp parameter
    ... not the private Access forums you find on the web. ... The short answer is you're using the wrong syntax in your batch file. ... that isn't the secured workgroup information file used to secure the database, ... You need to remove the "START /MAX" command, but even then it won't work ...
    (microsoft.public.access.security)
  • Re: problem with a batch file wkgrp parameter
    ... The short answer is you're using the wrong syntax in your batch file. ... that isn't the secured workgroup information file used to secure the database, ... permission to open this secured database. ... You need to remove the "START /MAX" command, but even then it won't work ...
    (microsoft.public.access.security)
  • Re: problem with a batch file wkgrp parameter
    ... The short answer is you're using the wrong syntax in your batch file. ... that isn't the secured workgroup information file used to secure the database, ... permission to open this secured database. ... You need to remove the "START /MAX" command, but even then it won't work ...
    (microsoft.public.access.security)
  • Re: Error: 18456, Severity: 14, State: 16
    ... to connect to SQL Server 2005 Express Edition from the command line. ... from scratch through using a batch file that is run from the command ... CreateDatabase.sql when run in Management Studio successfully creates ... the database that I require so I know the error doesn't lie there. ...
    (microsoft.public.sqlserver.connect)
  • Re: Error: 18456, Severity: 14, State: 16
    ... did you try conencting with the same syntax that you are using in the batch file via an interactive commandprompt? ... > to connect to SQL Server 2005 Express Edition from the command line. ... > the database that I require so I know the error doesn't lie there. ... I just listed these articles to show what path I am currently ...
    (microsoft.public.sqlserver.connect)