Development

Training

Tech Support

Database repair

Access Books

Discussion Forum

Join our Free newsletter for screenshots, news, hints & tips, new products, website additions and more!
subscribe
unsubscribe

Company profile
Contact us
FAQ
Resellers

 

 

 

 

 

Home : Tips : Modules

Modules

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