Results 1 to 7 of 7
  1. #1
    dgj32784 is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    22

    Open Access Database Using Command Line/Batch File - No Name Specified


    What is the syntax for opening a file using the command line/batch file with .accdb extension without specifying the file name? I regularly update my dbase and record the version in the file name, which I then copy to TabletPCs for data collection. I need a batch file that says "open any file in this directory with .accdb extension." There will only be the one dbase file in the directory.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    I don't know if batch file can do that.

    You can set an Advanced property of Access application to open the last used database when Access starts.

    EDIT: Thanks, Linq (see next post), I missed the meaning of 'record the version in the file name'
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by June7 View Post

    ...You can set an Advanced property of Access application to open the last used database when Access starts...
    If I'm reading this correctly, that's just the problem! The last database used is no longer in the Folder, because the current database has a different name from the last one opened!

    Never ran into a situation where someone was changing the name of the app every time it was revised, and my guess is that you cannot open a File using a Wildcard symbol as a name! To me, the best approach would be to

    1. Revise your app
    2. Save a copy, with the revised name, to a Folder used of just that purpose
    3. Change the name of the newly revised app to the original app name
    4. Distribute this copy to the end users.
    5. Have their copy of Access set to open the last database used, as suggested by June7

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    I set up on my users' computers a desktop shortcut to the database. And I don't change the name of the database that is distributed to users. I do what Linq described in the previous post.

    Addressing your original question, could have code read names of files in folder, and since there is only the one file, set a variable to the name. But why bother? Linq's suggestion is simpler.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    dgj32784 is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    22
    My thanks to you both. Simple is normally better. I was just trying to troubleshoot my laziness (not wanting to rename the file every time). On that note, do you know the DOS command to copy the most recently modified .accdb in a source directory to a destination directory? I suppose I could rename the file during that operation. The reason I'm interested is occasionally my users will have to put the most current dbase version on the TabletPCs without my supervision. If I can set up a batch file they can just double click and have what they need. My users are not technically inclined and having them copy and paste a file from the server to the TabletPC - requiring a specific rename during the process - would be unrealistic ;-)

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Review this article http://www.access.qbuilt.com/html/update_front_end.html

    Discovered the article through this thread http://forums.aspfree.com/microsoft-...ry-535775.html

    Right now I have copy/paste code in a VBScript but I plan to implement the method demonstrated in the article.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    dgj32784 is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    22
    Whoa! That's some shiznit. Not quite sure what to make of it. I'm going to give it a go after I try to fully wrap my head around it. Thanks June.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 24
    Last Post: 07-08-2013, 12:59 PM
  2. Replies: 7
    Last Post: 06-18-2012, 11:31 AM
  3. Replies: 1
    Last Post: 01-24-2012, 12:47 AM
  4. query Access databases from the command line
    By xinelo in forum Programming
    Replies: 9
    Last Post: 11-09-2011, 09:08 AM
  5. Replies: 2
    Last Post: 10-11-2010, 03:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums