Question : How do I execute a module in Access 2007

I used to quite like the previous "macro" functionality

However if I have the attached script in Access 2007 how do I execute it without going to the code and clicking "Run"


Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
Function Rebuild()
On Error GoTo Proc_030_Err
 
DoCmd.SetWarnings False
 
    DoCmd.OpenQuery "100 Clear Temp 01 ARSHIP with keys", acViewNormal, acEdit
    DoCmd.OpenQuery "110 ARSHIP with keys", acViewNormal, acEdit
    DoCmd.OpenQuery "300 Clear Temp 03 Sales F2007 on", acViewNormal, acEdit
    DoCmd.OpenQuery "310 Rebuild Temp 03 Sales F2007 on", acViewNormal, acEdit
 
    MsgBox "Tables Rebuilt", vbInformation, "Finished"
    
DoCmd.SetWarnings True
 
Proc_030_Exit:
    Exit Function
 
Proc_030_Err:
    MsgBox Error$
    Resume Proc_030_Exit
 
End Function

Answer : How do I execute a module in Access 2007

You have a function called Rebuild() in a module
Open the module and a window called immediate shows at the bottom.
If not shown select view menu > Immediate Window
In the immediate window type:
x = Rebuild() to run that function

You can use it through code depending on your project.
Random Solutions  
 
programming4us programming4us