Linking Macros/Modules to a form Control (?)

Yoplumpy

Registered User.
Local time
Today, 12:30
Joined
May 25, 2010
Messages
19
Hi All

I would really appreciate any help you can give - I am not very good with the modules side of things in Access so laymans terms would be useful :)

I have multiple make table queries that are being linked to excel. The only problem is that the macro that intiates these queries has 3 message box/warnings per report (and Set Warnings can't be turned off in the macro in MSA2007).

I was told that you can create a module to run on "click" on a form say, and turn off warnings and turn them back on after the module has executed. My problem is I don't know how to do this!

For example my Make Table query names are:

XLAttendancePathways
XLAttendanceCasework
XLAttendees

Could anyone share the required code and explain how I would link this to a button control?

Any help would be so gratefully received.

Many thanks

Paul
 
Paul you have the macro created so do the following:

Create a new form in design view, then press f11 to show the database window. Then drag your macro into the form, this will create a button for you but at present it is still tied to the macro, now you want to convert the macro to VBA.

Look at the Database Tools tab and then on the left it will give you an option to convert form macros to VBA, click it and then the button will show you [Event Procedure], click the elipse button on the right this will take you into the code screen, then you will see the query names.

Now all you need to add in is as follows before the query names (a line above):

docmd.setwarnings false

Then after the query names add an extra line

docmd.setwarnings true

Save and close the vba screen and it should run the queries and make your tables.
 
Cheers Trevor I will give that a go!

P
 

Users who are viewing this thread

Back
Top Bottom