Microsoft Access 2010 Error Number and Descriptions

For a list of all MS ACCESS 2010 errors,bugs and descriptions, go to Microsoft Access 2010 Error Number and Descriptions

Tutorial: Find Nulls – Is Null and Isnull(), Nz

Tutorial: Find and exclude null values in Ms Access 2010 : Is Null, Isnull() and Nz expressions

In the previous post, we found out that Null in MS access 2010 – is value that is Unknown to MS Access 2010. MS Access 2010 cannot compare it to zero-length string or number 0 for example. Since MS Access 2010 behaves unexpectedly when encounters and uses Null, it is important to identify and separate all null values, work around them or exclude them from day-to-day data manipulations.

What if you have to work with data that has Null Values?

Option 1 :  How to find and exclude null values in Ms Access 2010 : Is Null and Isnull()

SQL:
 To display Null Values using SQL query, we can simply use WHERE clause as follows:

[WHERE CustomerName  Is Null]

Or to  Exclude Null Values:

[WHERE  NOT CustomerName  Is Null]

 VBA: To avoid potential run-time errors when working with data that has null values use,

[If IsNull(CustomerName) Then ...]

Or to  Exclude Null Values:
[If Not IsNull(CustomerName) Then ...]

Option 2: Work Around Null Values – Convert Null in Ms Access 2010 : Nz function

Since Ms Access treats Null as something Unknown, it would throw errors and many surprises when you do not expect if you do not take care of Nulls.

For Example, if you try to add

(CustomerTotalPurchases +5) as TotalPurchases

 

Where CustomerTotalPurchases contains Null values, you would receive Null as TotalPurchases.

In MS Access Null means Unknown.  MS Access is just replying with Null meaning
“I do not know the answer”

To avoid making this error Microsoft Access provides the

Nz() function that can be used to check whether a field contains a value, whether the field is empty, or is null. The syntax of this function is:

Nz(Value, ValueIfNull) AS Appropriate Type

The Nz() function returns Value if value is not Null, and returns ValueIfNull

If Value is Null.

Example:  Nz(CustomerTotalPurchases,0) as TotalPurchases

Total Purchases  would  equal  0  if  CustomerTotalPurchases is Null

So 2 steps described above are crucial to find, exclude and work around Null in Ms access 2010. It is important to use SQL query ( WHERE Clause, Is Null)  or VBA ( Isnull) clause to exclude or separate Null Values and avoid Null Errors and bring stability to your application.

Ms Access 2010 Broken Reference, Missing Reference, Early Binding to Late Binding

Question: VBA – How to fix ms access 2010 missing reference, ms access 2010 broken reference errors?  How to convert from Early Binding to Late Binding?

Answer:  

The best way to fix missing reference error is by using as little ms access 2010 libraries as possible. In order to create external objects at run-time without using libraries go through this checklist to fix the problem.

Late Bound Conversion Checklist

  • Change all declarations from Specified Objects (i.e.  Excel,Outlook objects) to the generic Object data type.  Declarations should be :

    Ex. Dim golapp As Object

  • Change Set statements to GetObject or CreateObject `

    Ex.
    On Error Resume Next
    Set golapp = GetObject(, “Outlook.Application”)
    If Err.Number = 429 Then
    Set golapp = CreateObject(“Outlook.application”)
    End If
    On Error GoTo 0

  • Change any built-in constants to their intrinsic values
  • Add optional arguments that have a default value

Read More about how to fix broken or missing reference in my next post

For more advice on how to ms access 2010 reference problems without using VBA

Visit this website : Access Reference Problems

Tutorial: How to work with Null Values in Ms Access 2010

This Tutorial show you how to understand null values in ms access 2010, convert null values into meaningful values, how to avoid using null values in calculations in MS Access 2010 and give you hints of how to fix runtime errors associated with handling nulls in tables, forms, your vba and sql code. This tutorial would be useful if would like to fix errors: 2393 – You can’t set the IgnoreNull property of primary key to Yes, 3058 – Index of Primary key contain a Null value, error 3162 You tried to assign the Null Value to variable that is not a Variant data type and other errors in regards to null values.

Before you start working with data in MS Access 2010, please make sure you begin with the following 2 steps of the tutorial.

STEP 1 : Understand Null Value in MS Access 2010

Most of the time Null Value means the missing or unknown data. In your database you would not be able to compare Null Value to Anything. Trying to do so is the cause of many errors and frustrations. Let’s look at the example below:

A = null
B = null
C =3

If you compare A = B. This would return an error.
A<>B (returns an error)
A=C (returns an error)
A<>C (returns an error)

Try It yourself. MS Access 2010 gives error because: Null means Unknown, and if you compare anything to Unknown, Is is equal to it?
Ms Access 2010 responds: ” I do not know”

STEP 2: To Store or not To Store Nulls?

When creating a fillable form for the user, allow the user an option of leaving some fields blank (if it makes sense).

Then handle nulls at the table level:

a)        When setting up field properties, set the field’s Required property to “No”. You have allowed for table to store a null value.  In this case the user has the flexibility of not entering the value in that particular field.

b)       However, in my experience it is always better to store some symbol there that would mean “null value”. As development progresses you would find it useful not to have null values that can generate errors when used in functions for example. Therefore, set the Default property of the field to:

If Date – Date ()
If Text – “N/A” or “PENDING”
If number – 99999

Just document it well in your manual that these values mean NULL values (information has not been entered)

Drawbacks: You can only apply the default property to new records but not to existing ones

I hope these tricks above would help you to avoid :
Error 3058 “Index or primary key can’t contain a Null Value”
Error 3162 (You tried to assign the Null value to a variable that is not a Variant data
type)

It is essential to understand what is null value and know how to fix Ms Access 2010 errors surrounding the storing of nulls

My next post would explain of how to work with null values in MS Access 2010, find and exclude nulls if you wish using VBA DAO and ADO objects, how to avoid inconsistencies in SQL queries.

Tip #5 Open permanent connection between backend and frontend ms access data base

Question: MS Access 2010 – How keep a Connection Open to the Back End Database While Your Application Runs?

Answer:

Why?: Keeping connection open between front-end and back-end database is extremely important for efficient performance since data travels faster.

Report and Forms (from front-end database) in itself does not contain any data but are GUI representation of the data in back-end database. In order to get the data the front-end connects to back-end every time which slows down the database because it takes time to connect.

VBA Code : On this page (below) you can find a VBA code of how to open database on the background and keep the connection open using DAO objects.
http://www.fmsinc.com/microsoftaccess/performance/linkeddatabase.html

How to fix the error of collating sequence not supported with the specified file format in MS Access 2010?

Cause: MS ACCESS 2010 introduced a new “General – Legacy” sort order that is unrecognized by MS ACCESS 2007, thus the need to use MS ACCESS 2010′s “General – Legacy” sort order, which is equivalent to MS ACCESS 2007′s “General”.

Solution:

Instructions
1. Go to the Menu ->File tab in MS Access 2010,
2. Click Options
3. Click General
4. Change New Database Sort Order to “ General-Legacy
5. Go to the Menu -> Tools > Database Tools > Compact and Repair Database

Result : Error fixed


 

Notes: The solution here is for MS Access 2000 –old http://support.microsoft.com/default.aspx?scid=KB;en-us;q202150

MS Access 2010 tutorial – 3 tips to Optimize MS Access Form Performance

Question:  I’m using msoffice 2010 database software Access 2010. I need help to optimize database. My form in ms access 2010 loads very slowly. How can I improve the load time of the form?

Answer:  3 things that can make Ms access 2010 forms slow to load:

1. Many combo or list boxes (each requires its own query to run) or other “complex” form controls.

Tip: try to minimize the amount of list boxes with separate queries. Put all info in one query

2. Form based on a table or a query without criteria. This forces Access to retrieve the entire contents of the table that the form is looking at thus causing unnecessary network traffic.

Tip: Think database design. Use WHERE Criteria in SQL queries whenever possible to split data in smaller chunks and base tables on that.

3. Another tip I was given was to create a MS access 2010 form based on a small, simple table and open this form in hidden mode in an autoexec macro. This form then stays open in the background ensuring connection with the back end is constant. Since the queries are based on tables, the forms are based on queries à this trick would improve database performance significantly.

To successfully implement tip 3 , please read my next post: How keep a Connection Open to the Back End Database While Your Application Runs? ( coming soon)


 

I do not have training in access 2010, sql or vba. I need a query in MS Access 2010 to add New Column for existing table with default value

Answer:   you can write 2 SQL queries:

ALTER TABLE Customers ADD COLUMN CustNum NUMBER;

UPDATE TABLE Customers Set CustNum =’yourdefaultvalue’;

Result: after executing these 2 queries (which you can connect in the macro, you would have a new column CustNum in your Customers table and all values in that column would equal “yourdefaultvalue”

MS Access 2010 crash – VBE7.DLL

Question:  Ms Access  2010 crashing unexpectedly: MDB and ACCDB files will crash periodically.  I uncompile the mdb and it will work for a while longer, then crash again. Error message related to VBE7.DLL.
Problem Event Name: APPCRASH
Application Name: MSACCESS.EXE
Fault Module Name: VBE7.DLL

Answer: Finally, Finally in October 2011, Microsoft released a fix for this problem. For almost  2 years there were a lot of frustrated people. I started using MS ACCESS 2010 way before and was very angry at them. However now there is a fix.

 Microsoft has released an update for Microsoft Office 2010. This update provides the latest fixes for the 32-bit and the 64-bit editions of Office 2010. Additionally, this update contains stability and performance improvements.
http://support.microsoft.com/kb/2553385

 

 

MS Access 2010 – how to make database faster?

TIp 1:  

The most important MS Access SQL optimization tip I can give is to create as many temporary tables as possible. If you find that your ms report is loading very slow or just freezing on load. In the process of building a query based on other query the load time increases. So

If you sql looks like this:

Query 1:  select a,b from table1;

Query 2 :  select a,b from Query 1;

…….and so on…….

Query 35 : Select a,b from Query 34;

à Then Query 35 would run very slow

Solution:  Somewhere in the middle of creating your query based queries

Write a query : Select * INTO table17  from Query 17;

And then Continue with your queries:
Query 18 :  Select a,b from table17;