In this part of the video series you’ll learn the following:
Writing VBA Procedures
Overview Of VBA Modules And Procedures
Working With VBA Modules
The VBA Code Window
Creating A VBA Sub Procedure
Working With VBA Variables
Declaring Variables In VBA
Overview of Modules and Procedures:
Statements ->
Single lines of programming code that performs a single task.
Keywords ->
Words within statements which are part of VBA.
Procedures ->
Sets of statements designed to be run together. Procedures exist in modules.
Module ->
They hold 1 or more procedures. Stand alone modules are called standard modules.
Statements, declarations which can affect all the procedures in a module are called “General Declarations”
Here is a diagram of the previous explanation:
| MODULE | |||
| GENERAL DECLARATIONS | |||
| PROCEDURE | |||
| STATEMENT | |||
| STATEMENT | |||
| STATEMENT | |||
| PROCEDURE | |||
| STATEMENT | |||
| STATEMENT | |||
| STATEMENT |
The VBA Code Window:
The Option Compare Database is there to help with string comparisons.
Here is an Option Compare Database example:
Option Compare Database
Sub test()
‘Present – Option Compare Database
‘test 1: finds "s"
‘test 2: finds "S"
‘Comment out – Option Compare Database
‘test 3: finds "s"
‘test 4: does not find "S"
Dim str As String
Dim x As Integer
str = "test"
x = InStr(1, str, "s")
MsgBox x
End Sub
You don't have to have the Option Explicit statement, but it helps prevent variable misspellings
Free Access programming tutorial Video 2
Sign up for 10 FREE VBA videos that will help you do your job better at:
http://vbahowto.com/ms-access-tutorial
|
<<--HATE THE ADS? CLICK IMAGE TO GET THE "AD FREE" MODULE 1 VIDEOS! |







