Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2011
    Location
    Inside your mind
    Posts
    297

    Question Unanswered: Open new access window - With same login details as current user

    Hi guys,

    Having a bit of an issue here...

    I need to have a button on one form, that when clicked opens up a new instance of access, automatically logs into the database (using the old user permissions/login system), and loads the form required...


    Basically I have a main 'Admin' form that allows control over importing, editing, reporting, etc. I also have a button on it that opens up another form that the factory uses to input various bits of data during production. When an administrator does this though, I want the 'Factory' form to open as an entirely separate entity. That way It can be sized, moved around, have no ribbon, menu bar, etc, and just generally look more professional.


    Any ideas on how I can do this?


    If necessary, I don't see any reason whenever the button is clicked a new instance of access is opened, and automatically logs in with the 'factory' username, and blank password. This would fire the AutoExec script, and take care of the rest for me...

    Any ideas on how to code this would be a great help!


    Cheers everybody.
    Looking for the perfect beer...

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Not sure it's what you're looking for but you should have a look at: http://www.dbforums.com/microsoft-ac...-database.html
    Have a nice day!

  3. #3
    Join Date
    Jun 2011
    Location
    Inside your mind
    Posts
    297
    I found a solution in the end... (Sorry, been off sick).

    I found that you could open the MSACCESS with conditions, so I wrote a simple batch file that looked like:

    .bat:
    Code:
    @echo off
    start "" "C:\Documents and Settings\User\Desktop\db\Database.lnk" /user factory

    Which I loaded as a shell command using a button Click() event on the original form. With something like:

    Access VBA:
    Code:
    Dim intFile As Integer
    
    intFile = FreeFile()
    
    Open GetDBPath & "DB_Batch-Files\my_loader.bat" For Output As #intFile
    Print #intFile, "@echo off"
    Print #intFile, "start """" """ & Left(CurrentDb.name, InStrRev(CurrentDb.name, "\")) & "Database.lnk"" /user factory"
    Close #intFile
    
    Shell GetDBPath & "DB_Batch-Files\my_loader.bat", vbHide

    It simply finds the location of the file that needs to be loaded, and opens it as a new user (with password when necessary).


    Works like a charm. I click the button, a new version of access pops up, gets resized and hides toolbars as it should, logs in automatically and both can be used concurrently without issue. Perfect.


    Thanks for the suggestion Sinn.
    Looking for the perfect beer...

Posting Permissions

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