Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2009
    Posts
    2

    Unanswered: Start access from batch file

    I have an application that will start access from a batch file (started from a dos box in windows xp):
    1. Open access and present the user with a form in which the user enters some numbers.
    2. Use these numbers as input to a query.
    3. The results of the query will point to a link to a particular photo that I have stored on disc.
    4. Launch a viewer to display the photo.
    5. When the user closes the photo view, close everything down.
    The only steps the user should see are to run the batch file, enter the numbers and the close the viewer.

    So what I would like to know is - is this feasible? If so, I will tackle it is stages. The first thing I would like to know is:
    How to start access in a bat file so that it opens a form for input.
    Any advice appreciated greatly

  2. #2
    Join Date
    Jul 2004
    Location
    South Dakota
    Posts
    267
    First question...

    Why do you have to use a bat file? You can start Access and have it open a specific form for you.

    C

  3. #3
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Have a look at Tools - Start up.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  4. #4
    Join Date
    Feb 2009
    Posts
    2
    The reason I need to run access from a batch file is that access is opened by a program I am running. The problem is that the program calling access only allows a string length of 40 characters to call access. Ridiculous but that's the way it is. So if the path to an access database is relatively long and I want to pass some parmaters to access on opening, the string length would exceed 40 characters.
    I was hoping that if I package all my requirements in a batch file, I could run that from the program and not be constrained by 40 chars.

  5. #5
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    What sort of crazy application have you got there ^^

    Sorry but I have no in depth experience in command line parameters for ACCESS.EXE, but you might like to investigate those in help docs to see what your options are.

    Batch files are fading fast for me.

    You might also look into the possibility of using a .VBS file -- you may be able to bypass Access altogether.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  6. #6
    Join Date
    May 2008
    Location
    Raleigh, NC
    Posts
    151
    Try a search on 'command line parameters'. There may even be some here in the forum. I've run command lines from other programs such as a job scheduler and it calls Access along with a particular macro. Step 3 and forward I can't answer.

    Good luck!
    --If its free, take it for what its worth!

  7. #7
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    you can start access with a a whole series of settigns,, as others have said GOOGLE Access commandline switch

    you need to specify what db/application to use ie your MDB or MDE
    you need to set an autoexec macro in that application (or specify what macro to run when that application starts
    the rest is up to your coding/development skills.

    however as to whether that is feasable without showing the user what you are doing is another matter.

    essentially all you are doing is retrieving a URL to an image form your DB it may be better to do this another way. I'd be tempted to use PHP as a command line (rather than web) script. but thats me.

    you could use another language such as Java or VB. you could even do it in good old DOS batch.. export the data to a flat file, then reaqd through the file to find the match. the problem I see is openoing your image viewer with the filename as a parameter.. it must be possible, after all thats how the IS launches its photo viewer
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •