Results 1 to 2 of 2
  1. #1
    Auto is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2013
    Posts
    60

    vbscript open access db and execute sub

    Hi,
    i am having an access db that is basically to update alot of stuff inside of linked tables, and some more stuff, i wrote a vbscript file that should open the access db if its closed, and execute the sub named UpdateController.
    the issue is that if there is no other instance of access it works fine, but if i am having another access db opened, then it throws an Error that it cant find the procedure, i had looked around all over on the web, cant find any solution to this one, please if anyone could help, i would really appreciate.

    here is the vbscript code.

    Code:
    on error resume nextdim accessApp
    set accessApp = GetObject("C:\Feeds\UpdaterApp.accdb")
    if err.number = 0 then
    err.clear
    set accessApp = createObject("Access.Application")
    if err.number = 0 then
    err.clear
    set accessApp =  GetObject( , "Access.Application")
    end if
    
    
    accessApp.visible = true
    accessApp.UserControl = true
    accessApp.OpenCurrentDataBase("C:\Feeds\UpdaterApp.accdb"), false
    end if
    on error goto 0
    
    
    
    
    accessApp.Run "UpdateController"

    BASIC FACTS.
    1) my module name is not the same as my procedure name.
    2) my procedure is declared public.


    3) its not in a class module, just inside a regular module.
    4) it only occurs if another database is opened at the same time.

    any help on that?

    thanks in advanced.

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    if the only purpose of the updaterapp is to run a section of code why don't you just create a form and attach the code to the ON OPEN event of that form and set the form to be opened when the database is opened, then all you have to do is call the database to be opened, it runs, then shuts itself down.

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

Similar Threads

  1. Replies: 10
    Last Post: 02-27-2015, 11:28 AM
  2. Replies: 4
    Last Post: 10-03-2014, 12:27 PM
  3. Replies: 2
    Last Post: 09-15-2014, 01:51 PM
  4. Replies: 2
    Last Post: 11-21-2012, 09:57 AM
  5. Replies: 2
    Last Post: 06-20-2011, 09:20 AM

Tags for this Thread

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