Results 1 to 5 of 5
  1. #1
    guitarzycki is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2016
    Posts
    20

    Opening Access Database and Form

    I am trying to open a database from another one and go to a specific form. When I try using the method below, the new database does not get focus and the switchboard stays on top.



    Dim appAccess As Access.Application

    Set appAccess = CreateObject("Access.Application")
    appAccess.OpenCurrentDatabase "\\wi101wsf\Shares\Departmental\Production\Machini ng\PRODUCTION\_PROCESS_DATABASE_FILES\Mach_Tools.a ccdb"
    appAccess.UserControl = True
    Set appAccess = Nothing

    Using the shell and .bat file method (Shell "\\wi101wsf\Shares\Departmental\Production\Machini ng\PRODUCTION\_PROCESS_DATABASE_FILES\Mach_Tools.b at") the new database gets focus as desired, but I can't open the form I need

  2. #2
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    When you run the code, it may open the database and display a form - but your code won't necessarily stop running, so your Set appAccess = Nothing line just closes it again. Try taking that line out of that procedure to see if the database stays open.

  3. #3
    guitarzycki is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2016
    Posts
    20
    Thanks for the reply. Removing that line didn't seem to help. The target database is opening correctly, but it is not receiving the focus as it should. I have to go to the access on the task bar and switch to the other one.


    Quote Originally Posted by John_G View Post
    When you run the code, it may open the database and display a form - but your code won't necessarily stop running, so your Set appAccess = Nothing line just closes it again. Try taking that line out of that procedure to see if the database stays open.

  4. #4
    guitarzycki is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2016
    Posts
    20
    It could be that I am going about this all wrong, but how would you open a separate database from within another and open a form in that database having it get focus?

  5. #5
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    There was another thread on this exact question recently and from what I remember it is not possible unless you go via the operating system.

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

Similar Threads

  1. Replies: 4
    Last Post: 07-06-2012, 07:46 AM
  2. Opening an Access database issues
    By Paul-NYS in forum Access
    Replies: 1
    Last Post: 05-11-2012, 03:46 PM
  3. Replies: 4
    Last Post: 10-23-2011, 06:34 AM
  4. opening Access database -help!
    By arianasta in forum Access
    Replies: 1
    Last Post: 02-09-2011, 04:12 AM
  5. Opening access database problem
    By dr223 in forum Access
    Replies: 9
    Last Post: 03-31-2010, 04:48 PM

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