Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

access

ResolvedVersion 2007

Nikki has attended:
Access Intermediate course

Access

How do I create a macro in Access 2007

RE: Access

Hi Nikki

This is covered on the Access Advanced course. An example of a maco might be to run one query after another eg an append query followed by a delete query that have been already created. Suppose the queries are called AppendCompleted and DeleteCompleted then

1. Click Create Macro, Macro

2. Enter Action and Arguments

Action Argument
Setwarning No
OpenQuery AppendCompleted
OpenQuery DeleteCompleted
Msgbox All completed records moved

Close and save the macro as MoveCompleted

When you run the MoveCompleted macro the two queries are run one after the other without warning prompts apart from one message at the end.

Hope that helps for now.
Cheers
Doug

RE: Access

Thanks Doug. How can I create a button and attach the macro to the button? i.e the button could be on a form. Also, how do I get access to open on the form page by default?

RE: Access

Hi again Nikki

To get a form to open when you open the database
- Open your database
- click the Office button top left
- Click on Access Options
- Select Current Database
- In Display Form choose which form to open auromatically

To add a macro button to a form
- Open your form in Design view
- Click the Button (form control) button
- Choose the Miscellaneous category, Run macro
- Select which macro to run
- Choose to add text or a picture to the button

Cheers
Doug

Tue 4 Oct 2011: Automatically marked as resolved.

Access tip:

Closing form after a certain time period

To make a form close automatically after a certain time period, you need to assign the close function to a macro.

Save the macro and ope up the form in design view. open the Properties sheet.

In the TimerInterval property enter the length of time you want the form open for. This should be in milliseconds, so for instance if you want the form open for 5 seconds enter 5000, for an minute enter 60000.

You now need to attach your macro (to execute the Close action) to the OnTimer event property of the form.



View all Access hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.