Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: Visual Basic for Applications Is Both a Compiler and an Interpreter


View products that this article applies to.

Summary

This article discusses whether the Visual Basic for Applications programming language is a compiled language or an interpreted language.

↑ Back to the top


More information

Traditional compiled languages, such as C, compile human-readable source code into machine-readable, and much faster, object code. These object programs then need to be linked into an executable file to be used. Syntax errors are not generally located until the code is completely compiled. (Parsing compilers are an exception.)

Traditional interpreted languages, such as QBasic, use interpreters that read each line of code and translate it into computer instructions as you write it. An advantage of this method is that an interpreter can test your code as you write it. In some cases this line-by-line interpretation can be slow.

Visual Basic for Applications incorporates elements of both compiled and interpreted languages. Visual Basic for Applications does interpret each line of code as you write it, but Microsoft Access performs this interpretation in the background, and does not exhibit any performance degradation because of this interpretation.

In addition to this interpretation, Microsoft Access also compiles your code into a combination of compiled and interpreted code known as pseudocode (p-code). This p-code runs much faster than interpreted code. The compilation takes place either when you first run the code, or when you click Compile MyDatabase on the Debug menu.

Microsoft Access also provides another mechanism for keeping database programs compiled and secure. This feature is called Make MDE File, and it is found under Database Utilities on the Tools menu. It removes the text representation of your Visual Basic for Applications code, and stores just the binary compiled p-code.

If your database contains Visual Basic for Applications code, saving your database as an MDE file compiles all modules, removes all editable source code, and compacts the destination database. Your code continues to run, but it cannot be viewed or edited, and the size of your database is reduced because of the removal of the code.

Saving your database as an MDE file prevents the following actions:
  • Viewing, modifying, or creating forms, reports, or modules in Design view.
  • Adding, deleting, or changing references to object libraries or databases.
  • Changing code using the properties or methods of the Microsoft Access or VBA Object models, because an MDE file contains no source code.
  • Changing your database's VBA project name using the Options dialog box.
  • Importing or exporting forms, reports, or modules. However, tables, queries, and macros can be imported from or exported to non-MDE databases. Any tables, queries, or macros in an MDE database can be imported into another database, but no forms, reports, or modules can be imported into another database.

↑ Back to the top


Keywords: KB209176, kbprogramming, kbinfo, kbhowto

↑ Back to the top

Article Info
Article ID : 209176
Revision : 4
Created on : 10/11/2006
Published on : 10/11/2006
Exists online : False
Views : 279