Results 1 to 10 of 10
  1. #1
    spacekowboy is offline Novice
    Windows XP Access 2003
    Join Date
    May 2012
    Posts
    17

    Open and log in to database through batch file

    Hi, we are trying to automate a process. Is it possible to pass the username and password of the database through a batch file?

    I have this so far that prompts for the password:

    "C:\Program Files (x86)\Microsoft Office\Office15\MSACCESS.EXE" "\\path_to_database\database.mdb" /wrkgrp "\\path_to_mdw_file\wrkg.mdw"



    Any help on this would be appreciated

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    If there is, it does not sound like a lot of fun. I have managed to use VBA to get the handle of dialog boxes. They are usually a child to the main app's Window. Not sure how you would pass that info back to the script. It might be easier to bypass the MDW.

  3. #3
    spacekowboy is offline Novice
    Windows XP Access 2003
    Join Date
    May 2012
    Posts
    17
    I did find some command line switches to try on this site:

    https://support.microsoft.com/en-us/kb/209207

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    What happens if you supply the pwd switch and not the mdw path? Maybe if you practice with a shortcut straight to the MDW and provide the switch within the shortcut.

  5. #5
    HiTechCoach's Avatar
    HiTechCoach is offline MS MVP - Access Expert
    Windows 8 Access 2013
    Join Date
    Jul 2010
    Location
    Oklahoma, USA
    Posts
    702
    Another Microsoft KB: https://support.office.com/en-us/art...8-1F5DF9702BF1

    Try add the switches /user and /pwd

    Try this order:


    Code:
    C:\Program Files (x86)\Microsoft Office\Office15\MSACCESS.EXE" "\\path_to_database\database.mdb" /nostartup /user USERNAMNE /pwd *** /wrkgrp "\\path_to_mdw_file\wrkg.mdw"

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by HiTechCoach View Post
    ...
    Try add the switches /user and /pwd

    Try this order:
    ...
    That looks promising. Nice touch using nostartup.

  7. #7
    HiTechCoach's Avatar
    HiTechCoach is offline MS MVP - Access Expert
    Windows 8 Access 2013
    Join Date
    Jul 2010
    Location
    Oklahoma, USA
    Posts
    702
    Let us know if that works for you.

  8. #8
    spacekowboy is offline Novice
    Windows XP Access 2003
    Join Date
    May 2012
    Posts
    17
    It looks like that is going to work! Many thanks!

  9. #9
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by spacekowboy View Post
    It looks like that is going to work! Many thanks!
    Were you able to supply the path to the MDW after the user and pwd switch?

  10. #10
    spacekowboy is offline Novice
    Windows XP Access 2003
    Join Date
    May 2012
    Posts
    17
    No, before

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

Similar Threads

  1. Replies: 1
    Last Post: 10-01-2015, 09:14 AM
  2. Replies: 12
    Last Post: 06-27-2013, 07:29 AM
  3. Replies: 6
    Last Post: 09-14-2012, 11:58 AM
  4. Run batch file
    By shay in forum Access
    Replies: 3
    Last Post: 12-15-2010, 09:47 AM
  5. Running Batch File
    By NoiCe in forum Programming
    Replies: 2
    Last Post: 03-21-2010, 07:05 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