Instructor-led training - Access VBA Training

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

Access VBA Training Courses London, UKAccess VBA Basics Training Course

Microsoft Access Intro Intermediate (all versions)

Face to face / Virtual closed & onsite training. Restaurant lunch included at STL venues.

  • 2 days Instructor-led
London & UK wide

Learn all about Procedures, Functions, and Objects in our VBA Basics Training Courses for MS Access. Three levels are available: Introduction, Intermediate and Advanced.

This basics course teaches control program execution, forms and working with the PivotTable object - a popular unit among most of our course attendees.

Free manuals

We are providing a range of our course manuals free of charge.

Why not share this resource with your friends and colleagues?

Training manual sample

Below are some extracts from our Access training manuals.

Visual Basic for Applications or VBA is a development environment built into the Microsoft Officeã Suite of products.

VBA is an Object Oriented Programming (OOP) language. It works by manipulating objects.  In Microsoftä Officeâ  the programs are objects. 

In Access worksheets, tables, forms, reports and queries are also objects.

In VBA the object is written first

I’m fixing house number 42 = .House.42.Fix

          House 42      Fix

English          .noun  .noun  .verb

VBA    .object .child object  .meth


When working in VBA tell Access exactly what to do.  Don’t assume anything.



 

 

Code Window

Project

Explorer

 


Title bar, Menu bar and Standard toolbar

 

The centre of the Visual basic environment.  The menu bar and toolbar can be hidden of customized.  Closing this window closes the program.

 

Project Explorer

Provides an organized view of the files and components belonging to the project. 

If hidden the Project Explorer can be displayed by pressing Ctrl + R

 

Properties Window

Provides a way to change attributes of forms and controls (e.g. name, colour, etc). If hidden press F4 to display.

 

Code Window

Used to edit the Visual basic code. Press F7 and it will open an object selected in Project Explorer.  Close the window with the Close button that appears on the menu bar.

 


 

 


If the Visual Basic Help files are installed, by pressing F1, a help screen displays explaining the feature that is currently active:



Alternatively use the Ask a Question box on the menu bar to as a quick way to find help on a topic.

To close the Visual Basic Editor use one of the following:

·       Open the File menu; select Close and Return to Microsoft Access

 

OR

 

·       Press Alt + Q

 

OR

 

·       Click  Close in the title bar.

 

 

Procedure is a term that refers to a unit of code created to perform a specific task.  In Access, procedures are stored in objects called Modules.


Standard modules can be used to store procedures that are available to all objects in your application

Within a project you can create as many standard modules as required.  You should store related procedures together within the same module.

Standard modules are also used to declare global variables and constants.

To create a standard module in the VB Editor:

·       Display the Properties window if necessary

·       In the Properties window change the name of the module

A procedure is a named set of instructions that does something within the application.

To execute the code in a procedure you refer to it by name from within another procedure.  This is known as Calling a procedure.  When a procedure has finished executing it returns control to the procedure from which it was called.

There are two genera types of procedures:

Sub procedures

perform a task and return control to the calling procedure

 

Function procedures

perform a task and return a value, as well as control, to the calling procedure

 

If you require 10 stages to solve a problem write 10 sub procedures.  It is easier to find errors in smaller procedures than in a large one.

The procedures can then be called, in order, from another procedure.

There are rules and conventions that must be followed when naming procedures in Visual Basic.

While rules must be followed or an error will result, conventions are there as a guideline to make your code easier to follow and understand.

The following rules must be adhered to when naming procedures:

·       Maximum length of the name is 255 characters

 

·       The first character must be a letter

 

·       Must be unique within a given module

 

·       Cannot contain spaces or any of the following characters: . , @ & $ # ( ) !

 

You should consider these naming conventions when naming procedures:

·        As procedures carry out actions, begin names with a verb

 

·        Use the proper case for the word within the procedure name

 

·        If procedures are related try and place the words that vary at the end of the name

 

Following these conventions, here is an example of procedure names:

 

PrintClientList

 

GetDateStart

 

GetDateFinish

 

Most Access tasks can be automated by creating procedures.  This can be done by either recording a macro or entering the code directly into the VB Editor’s Code window.

Sub procedures have the following syntax:

[Public/Private] Sub ProcedureName ([argument list])

 

Statement block

 

End Sub

Public indicates procedure can be called from within other modules.  It is the default setting

Private indicates the procedure is only available to other procedures in the same module.

The Sub…End Sub structure can be typed directly into the code window or inserted using the Add Procedure dialog box.

To create a sub procedure:

·       Create or display the module to contain the new sub procedure

·       Click in the Code window

·       Type in the Sub procedure using the relevant syntax

Type in the word Sub, followed by a space and the Procedure name

Press Enter and VB inserts the parenthesis after the name and the End Sub line.

Below is an example of a basic sub procedure:



Thanks. Your download will begin shortly.

Please help us

Share or create a link to this manual today!

Just follow these simple instructions...


Server loaded in 0.12 secs.