Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2004
    Posts
    139

    Unanswered: Run Macro Before Form Opens W/data

    I have a form that when opened pulls the data from a query. However, I need to have a macro run first to update the information in a table that the query pulls data from. I have been trying some of the form events but have not hit upon one that will run the macro before loading the data for the form. Does anyone have a suggestion of how I can accomplish this task?

    Thanks
    B&R

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    i dont do macros, but this is a way to defer processing until the form is fully loaded.

    stacking your desired sequence into _Timer() probably will give you the control you are seeking.

    izy
    currently using SS 2008R2

  3. #3
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Hey Iz ... The only problem with a kick off within the form is that the user has started the form ... You really don't want the system to sit there chugging along retrieving the data then **SPROING** display the form ...

    Another way (and I did this) is to popup the form with everything disabled with a label displayed showing something like: *** RETRIEVING DATA ***

    You run your refresh/retrieve query of your data then hide the label and activate/enable your controls on the form ...
    Back to Access ... ADO is not the way to go for speed ...

  4. #4
    Join Date
    Apr 2006
    Location
    Huddersfield, UK
    Posts
    154
    Greets;

    I agree with the Poobah, i'd personally do it that way, though there is sort of another way, but that involves 2 forms, and if you don't know how to display/hide labels then I'd do it this way.

    Set up a new form (when a the menu button is clicked for the original form, this form is displayed instead)
    You can display "Gathering Data" on this form
    Create the macro you wish to run, and add in an extra line to a) close this new form, and b) open the current form you have
    use the onload() setting to run this macro;

    Hope this helps;

    Dan
    sometimes simple is best.... and i'm just a simple fellow.

  5. #5
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by danlindley
    Greets;

    I agree with the Poobah, i'd personally do it that way, though there is sort of another way, but that involves 2 forms, and if you don't know how to display/hide labels then I'd do it this way.

    Set up a new form (when a the menu button is clicked for the original form, this form is displayed instead)
    You can display "Gathering Data" on this form
    Create the macro you wish to run, and add in an extra line to a) close this new form, and b) open the current form you have
    use the onload() setting to run this macro;

    Hope this helps;

    Dan
    Actually Dan, that is pretty nifty. You could even extend that idea by having that hidden form perform ALL of your various data loading needs ... Just build it to recognize what data needs to be loaded where ...
    Back to Access ... ADO is not the way to go for speed ...

Posting Permissions

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