Results 1 to 4 of 4
  1. #1
    DHIGHTO is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2015
    Posts
    30

    Starting Access using VBA

    Hey guys,



    I'm trying to start an existing Access db using vba in Excel. The code I'm running will start the db, but the db immediately closes. Here is my code

    Code:
    Sub Example1()
     'Access object
    Dim appAccess As Object
    'create new access object
    Set appAccess = CreateObject("Access.Application")
     'open the accesS project
    Call appAccess.OpenCurrentDatabase( _
     "C:\user\AR DAILY REPORT.ACCDB")
      appAccess.Visible = True
    End Sub
    I can't figure out what is wrong.

    Thanks,

  2. #2
    Rawb is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    Try opening a Form in your code. If you only have the Access Runtime, it's possible the program may see that you don't have any open objects (Forms or Reports) and is closing itself.

  3. #3
    DHIGHTO is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2015
    Posts
    30
    Thanks! It worked!

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442

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

Similar Threads

  1. Replies: 1
    Last Post: 10-28-2013, 12:32 PM
  2. autonumber in access not starting at 1
    By b.saimsc in forum Forms
    Replies: 5
    Last Post: 10-16-2012, 03:45 AM
  3. Starting Access 2010 not solved
    By mrkaye in forum Access
    Replies: 11
    Last Post: 10-12-2011, 02:50 PM
  4. Replies: 3
    Last Post: 08-25-2011, 02:28 PM
  5. Starting an Access database for a group...
    By kkrishna in forum Access
    Replies: 8
    Last Post: 05-19-2010, 05:29 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