Microsoft Office Tutorials and References
In Depth Information
Writing Your Own VBA Procedures
Database: The word Database means to use the same rules that
the rest of the database uses when comparing values. Using the same
rules is always a good idea; otherwise, things could get very confusing.
Nevertheless, two other options (Binary and Text) are available:
Option Compare Binary: The Binary option tells VBA to
consider uppercase letters to be smaller than lowercase letters when it
compares strings. (With Option Compare Database, VBA
considers uppercase and lowercase letters to be equal.)
Option Compare Text: The Text option tells VBA to use the sort
order of your system’s locale (the country and spoken language of your
location) to compare strings. This option may be useful when you’re
creating a database to be used in non–English-speaking countries.
Writing Your Own VBA Procedures
All the code that you write is contained within procedures. A procedure is
a single chunk of code that performs a series of actions when called. A sub
procedure always begins with a Sub statement or a Private Sub statement
and ends with an End Sub statement. A function procedure begins with a
Function statement and ends with an End Function statement.
Chapter 1 of this minibook discusses sub and function procedures in detail.
You can add new procedures to class modules or standard modules. How
you do so depends on where you want to place the procedure.
Creating a new standard procedure
A procedure in a standard module is available to all Access objects and isn’t
tied to any particular control or event. To create a new procedure in a
standard module, follow these steps:
1. Create a new standard module, as described in Book VIII, Chapter 1.
Chapter 2
Open an existing module by double-clicking its name in the
Navigation Pane.
2. Choose Insert Procedure in Visual Basic Editor.
The Add Procedure dialog box opens, as shown in Figure 2-8.
Search JabSto ::

Custom Search