Results 1 to 4 of 4
  1. #1
    hxc80895 is offline Novice
    Windows XP Access 2003
    Join Date
    Aug 2012
    Posts
    2

    Start up MS-Access with /x option and run a macro in a different access db

    Say I have two MS-Access databases, mydb1 and mydb2. In mydb2 I have a macro "mymacro" that I want to execute against mdb1. Is it possible to start up MS-Access this way:



    msaccess mydb1 /x mydb2:mymacro

    First off I don't know if you can run a macro from a different database.

    If it *is* possible, what is the correct syntax? (I just took a wild guess, since I couldn't find it documented.)

  2. #2
    R_Badger is offline Knows a few tricks
    Windows XP Access 2003
    Join Date
    Feb 2012
    Location
    Suffolk, UK
    Posts
    262
    Crazy question, but have you considered just importing it?

    I say this as I assume (as no other info was given) that the two files operate completely independently of each other ordinarily and aren't for example a back/frontend (although I'm not sure why you would want a macro in a backend, but saying that I have a table in my frontend files).
    Last edited by R_Badger; 08-07-2012 at 08:05 AM. Reason: Clarification

  3. #3
    hxc80895 is offline Novice
    Windows XP Access 2003
    Join Date
    Aug 2012
    Posts
    2
    Well, the reason behind my question is that I have quite a number (hundreds, actually) of mdb's -- some large, some small -- that I want to run a macro against. I do not want to open each one interactively (I've got better things to do with my time!). The macro will extract procedures and table definitions in order to store them in flat files for easy searching among other things.

  4. #4
    R_Badger is offline Knows a few tricks
    Windows XP Access 2003
    Join Date
    Feb 2012
    Location
    Suffolk, UK
    Posts
    262
    Knowing that is armed!

    There *potentially* is a solution i can think of in the back of my head (half baked) it probably isn't quite what you envisaged, but it should work (as far as I can see you cant do it using command line switches), however you may be able to achieve it from vb.

    You might be able to use the transferdatabase method (vb reference here) command to programmatically transfer it to your target database(s), and modify allenbrownes example code here to get the directory contents (assuming in this case they are all in the same place) then theoretically use shell filepath /x macroname to run it.

    I haven't tried it, but it *might* work!

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

Similar Threads

  1. Replies: 7
    Last Post: 06-14-2012, 01:54 PM
  2. Hide access on start up
    By beha in forum Access
    Replies: 3
    Last Post: 01-06-2012, 04:57 PM
  3. access to start form another program
    By munilmg in forum General Chat
    Replies: 1
    Last Post: 12-02-2011, 03:06 AM
  4. Remove Access ribbon on start
    By azaz in forum Forms
    Replies: 2
    Last Post: 12-30-2010, 03:30 AM
  5. how to start with access 2007
    By tintincute in forum Access
    Replies: 4
    Last Post: 08-31-2010, 11:52 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 - Senior Forums