Solved

When to use Option Compare Database versus Option Explicit in an Access Form?

Posted on 2009-03-29
2
324 Views
Last Modified: 2013-11-28
How does one determine whether to use Option Compare Database versus or in conjunction with Option Explicit in an Access Form?  When I run analyze performance it tells me to use Option Explicit in my form.  I don't know if this should replace Option Compare Database or be added beneath it.  The code is below
Option Compare Database
 

Private Sub Run_Click()

    Me.Requery

End Sub

Open in new window

0
Comment
Question by:kgittinger
2 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) earned 125 total points
ID: 24014738
You want to use both.  Option Explicit means that you must declare a variable first before you can use it.  This helps minimize compile errors down the road ... and prevents confusion wherein you might use the same variable name twice when you did not intend to.

mx
0
 
LVL 44

Assisted Solution

by:GRayL
GRayL earned 125 total points
ID: 24014744
Add it beneath.  It means you will get an error if you use an undeclared variable.  Without it , any variables used that are not declared with a Dim statement are created as Variants, with all the incumbent overhead.,
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now