Microsoft Access Help Center
Microsoft Access
     
HomeProductsServicesLearningForumContact

         

Home > Tips > Modules

 

Browse

 

 

Microsoft Access Module Tips

Learning Visual Basic for Applications

What is an event procedure?

Stuck in a Code Loop?

Learning Visual Basic for Applications
Learning VBA for the first time can be a daunting experience. There is so much to it that you wonder if you will ever learn it all. Now for the good news: you can get 80% of the benefit learning 20% of the code. Certain parts are used again and again and it is here where you should devote your attention.

As a starter, you might consider learning the following: types of variables (e.g. integers, strings, variants), loop structures (e.g. for...next, if...then, do...loop), Recordsets (e.g. ), Msgbox function, Dim function, creating Subroutines and Functions. This should get you going and it is surprising what you can do with this alone.

What is an event procedure?
Each control on a form or a report has a set of predefined possible events, for instance a button control may be clicked. An event procedure is the VBA code that defines what happens when that event occurs.

Event procedures are written and saved as Sub procedures in a code module. These Sub procedures are called by Access.

Stuck in a Code Loop?
If ever you get stuck in an infinite code loop use CTRL+BREAK to exit the procedure

 

Forum Archive | About us | Privacy Policy

© Access World 2010