Re: Option Compare Database

R

Rick Brandt

David said:
Where can I look up more information about how "Option
Compare Database" - "Option Explicit" works?

Let me guess. You have Access 2000 or 2002, right?
The help topics below exist in those versions. They're just not so easy to find.


From Access 97 Help File
********************
Option Compare Statement:

Used at module level to declare the default comparison method to use when string data
is compared.

Syntax
Option Compare {Binary | Text | Database}

Remarks
If used, the Option Compare statement must appear in a module before any procedures.

The Option Compare statement specifies the string comparison method (Binary, Text, or
Database) for a module. If a module doesn't include an Option Compare statement, the
default text comparison method is Binary.

Option Compare Binary results in string comparisons based on a sort order derived
from the internal binary representations of the characters. In Microsoft Windows,
sort order is determined by the code page. A typical binary sort order is shown in
the following example:

A < B < E < Z < a < b < e < z < À < Ê < Ø < à < ê < ø

Option Compare Text results in string comparisons based on a case-insensitive text
sort order determined by your system's locale. When the same characters are sorted
using Option Compare Text, the following text sort order is produced:

(A=a) < ( À=à) < (B=b) < (E=e) < (Ê=ê) < (Z=z) < (Ø=ø)

Option Compare Database can only be used within Microsoft Access. This results in
string comparisons based on the sort order determined by the locale ID of the
database where the string comparisons occur.

*******************************
Option Explicit Statement:

Used at module level to force explicit declaration of all variables in that module.

Syntax
Option Explicit

Remarks
If used, the Option Explicit statement must appear in a module before any procedures.

When Option Explicit appears in a module, you must explicitly declare all variables
using the Dim, Private, Public, ReDim, or Static statements. If you attempt to use an
undeclared variable name, an error occurs at compile time.

If you don't use the Option Explicit statement, all undeclared variables are of
Variant type unless the default type is otherwise specified with a Deftype statement.

Note Use Option Explicit to avoid incorrectly typing the name of an existing
variable or to avoid confusion in code where the scope of the variable is not clear.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top