Art Exhibitions            Index           Links           Home             Feedback


Last                                                                   Next


Community tute 14 - Exporting from Access to another application using a macro.

1. Start Access and open the database we created in the last tute, select the 'Queries' tab and then hit the 'New' button. If you did not compete the last tute you can download the database click here to download.


2. Add the following fields and save the table as 'InbetweenTable'.


3. Save and close the table, select 'No' as we don't want to create relationships off this table.


4. Create a new query.


5. Add the calculate totals query that we created in an earlier tute.


6. Change the query type to an append query.


7. Set the query to append to the 'InbetweenTable'.


8. Add both the fields to the query (double click on the names in the table) and save the query as 'Append data to InbetweenData'.


9. Create a new query, add the 'InbetweenTable' and change the query to a 'Delete Query'.


10. Add the 'ExperienceLevel' field and save the query as 'Delete all records from InbetweenTable'.


11. Now create a new macro, hit the 'New' button.


12. Enter 'SetWarnings' as the first action in the macro, this switches off the system messages so you don't get a message that says 'Are you sure you want to append records'.


13. The next action in the list is to delete all the records form the 'InbetweenTable' so each time the macro runs we output the latest data .


14. Now add the action that runs the append query, this puts the data into the table that we will export in the next step.


15. Final step is to output the data in excel format, must specify the format type and file names.


16. Save the macro as 'Output to Excel'


17. Now we can add a button to the main form that runs this macro and outputs the data automatically. Select the 'MainForm' object and press the 'Design' button.


18. Click on the command button icon to create a new button.


19. Lets view the properties of the new button, select the button and select 'Properties' from the 'View' menu if you cant see the properties of the button.


20. Change the 'Caption' of the button (determines what is displayed on the form) to 'Export Data'.


21. Add the macro name 'Output to Excel' to the On Click property by using the drop list. Switch to form view try the button, close and save the form.





Copyright © 1999 R&D Robotics Pty Ltd, All rights reserved.
Any copyright subsisting in the above code and or literary works including source files vests with R&D Robotics Pty Ltd. ACN 086 345 137



Last                                                                   Next