Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2008

    Unanswered: Macro to perform command

    what should i do to make a macro that automatically perform the command button 'cmdload' found in form "Orders" . Its because i want to schedule the macro... thanks

  2. #2
    Join Date
    Jan 2007
    Provided Answers: 10
    Whatever's behind the click event of your button, make it into a Public sub or function in a new module.

    Then you can call the function from both the click event and Macro by referencing the sub or function by name.
    Home | Blog

  3. #3
    Join Date
    Mar 2003
    The Bottom of The Barrel
    Provided Answers: 1
    Wait... schedule? As in, you want things to run whether he user is at the keys or not?

    Are you absolutely certain a macro inside access is the best way to tackle this one?
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  4. #4
    Join Date
    Sep 2008
    what i want is to run an automatic schedule to run a specific macro...

  5. #5
    Join Date
    Dec 2004
    Madison, WI
    IF you're looking to perform some type of updates on a table at a specified time (versus when the user opens a form), then I might make a separate mdb, link in the tables, write your query to append/delete or whatever, create an autoexec macro which runs the query (and then exits the mdb), and then schedule (Windows Task Schedular) to open that mdb at the time you specify (preferably when users would not be in the mdb.)

    Or (as I'm guessing you want to do) - if you want to run the cmdLoad event (in the form) at some point in time (ie. based on another event for a field), make the Private sub cmdLoad_Click() to Public sub cmdLoad_Click(). Then you can call the cmdLoad_Click - ie. Call cmdLoad_Click() wherever you want to in code. (or you can also use the OnTimer event, setting the Timer value of the form to perform the macro at some # of seconds when the timer has counted down - but be careful on using the Timer event.)

    I'd also try to stop using macros and instead, write vba code (such as what MSAccess puts in for code after using the wizard to create a button.) It seems as though you like to use macros a lot. While they are ok and work, you can do exactly the same thing in vba code as in a macro and you'll find in the long run that it's a LOT easier just writing some vba code versus using a macro.
    Last edited by pkstormy; 09-15-08 at 21:56.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

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