Go Back   Access World Forums > Microsoft Access Reference > Sample Databases

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 07-19-2017, 03:34 PM   #1
ridders
AWF VIP
Gold Supporter
 
ridders's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 2,923
Thanks: 54
Thanked 686 Times in 634 Posts
ridders has a spectacular aura about ridders has a spectacular aura about
Access Error Codes

The attached db contains details of all VBA errors as supplied by Microsoft

I compiled this list of Access VBA error codes whilst creating an error logging system for one of my databases.

Its also very useful as a reference e.g. when posters mention a particular error in their database.

I hope this is useful to others



A report is also available but its about 90 pages long so think before you print it!

Clicking the Search the Internet button runs a Google search for the selected error:



NOTE: If anyone has a full list of JET errors which can also arise occasionally, let me know and I'll add these to the database
Examples include error numbers -2147467259, -2147221233, -2147352567, -2147024894.
Apparently there is a way of converting these negative numbers into standard VBA error codes but I don't know how to do that

=======================================
UPDATE: 28/07/2017
I've just realised the report in v1 of this db threw up a parameter error.
Now fixed and I've updated the attached database to v2.
Attached Images
File Type: png AccessErrorCodes.PNG (19.1 KB, 499 views)
File Type: png ErrorGoogleSearch.PNG (72.5 KB, 75 views)
Attached Files
File Type: accdb AccessErrorCodes v2.accdb (1.40 MB, 71 views)

__________________
Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
, Tapatalk


If this answer has helped, please click the Thanks button and/or click the 'reputation' scales symbol on the left and leave a comment. Cheers!

Last edited by ridders; 11-02-2017 at 05:06 PM.
ridders is offline   Reply With Quote
The Following User Says Thank You to ridders For This Useful Post:
SJS66 (09-03-2017)
Old 07-20-2017, 09:04 PM   #2
The_Doc_Man
AWF VIP
 
Join Date: Feb 2001
Location: Suburban New Orleans, LA, USA
Posts: 10,907
Thanks: 38
Thanked 892 Times in 804 Posts
The_Doc_Man is a name known to all The_Doc_Man is a name known to all The_Doc_Man is a name known to all The_Doc_Man is a name known to all The_Doc_Man is a name known to all The_Doc_Man is a name known to all
Re: Access Error Codes

Colin - for the negative number cases, they TYPICALLY translate to something in HEX that can be translated by breaking down the field.

Express the negative number as an unsigned HEXADECIMAL. Then filter it against this

https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx

and also work from here

https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx
__________________
I'm a certified grandpa (3 times now) and proud of it.
Retired over one year and survived being home all day with the wife. She must really love me.
The_Doc_Man is offline   Reply With Quote
Old 07-24-2017, 05:03 AM   #3
The_Doc_Man
AWF VIP
 
Join Date: Feb 2001
Location: Suburban New Orleans, LA, USA
Posts: 10,907
Thanks: 38
Thanked 892 Times in 804 Posts
The_Doc_Man is a name known to all The_Doc_Man is a name known to all The_Doc_Man is a name known to all The_Doc_Man is a name known to all The_Doc_Man is a name known to all The_Doc_Man is a name known to all
Re: Access Error Codes

In response to a PM on this subject:

Take an error code such as -2147352567 and bring up the ubiquitous CALCULATOR. Switch it from "Standard" to "Programmer." Be sure you are in DECIMAL mode. Paste that number into the working area. Now switch mode to HEXADECIMAL. You will get FFFFFFFF80020009 and you can discard the 8 leading "F" characters. So now you have the string 80020009.

Looking up the HRESULT stuff ( https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx ) you see that this can be broken down as

First 4 bits: 0x8 - which means non-critical error. (The critical errors of the form 0xC are only seen on a BSD because they crash Windows).

Next 12 bits: 0x002 - which says iDispatch error. You have to look a bit for this one.

Next 16 bits: 0x0009 - which says ERROR_INVALID_BLOCK. (See also https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx for the list of low-numbered errors.) I'm not going to swear that I understand why you would get this error, but the last time I saw it, it was due to having the wrong type of variable in one of arguments of an automation call - using a Variant when the call specifically demanded a string.

Let's do another:

With the calculator, code -2147024894 resolves to FFFFFFFF80070002, or 0x8, 0x007, 0x0002. The same comments as above apply for 0x8. The 0x007 is a WIN32 error (or OLE error). Code 0x0002 is FILE_NOT_FOUND. This one speaks for itself.

Hope that helps.

__________________
I'm a certified grandpa (3 times now) and proud of it.
Retired over one year and survived being home all day with the wife. She must really love me.
The_Doc_Man is offline   Reply With Quote
Old 07-24-2017, 05:20 AM   #4
ridders
AWF VIP
Gold Supporter
 
ridders's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 2,923
Thanks: 54
Thanked 686 Times in 634 Posts
ridders has a spectacular aura about ridders has a spectacular aura about
Re: Access Error Codes

Thanks Doc

I just found this helpful post at:
https://answers.microsoft.com/en-us/...1-d79a4c09a73c

Quote:
runtime error 3376 vs -2147217865 (80040e37)

Error codes are unsigned 32-bit numbers, which are represented in a linear fashion from 0 (no bits set) to hexadecimal FFFFFFFF (all bits set). This is a very large number - almost 4.3 billion.
In VBA there is no such data type, so error codes are treated as signed 32-bit numbers (Long). These numbers are represented in a circular fashion, from 0 to 7FFFFFFF (+2147483647) and then from 80000000 (-2147483648) to FFFFFFFF (-1).
So actually, half of all possible error codes are negative!
Different component libraries have different ranges of error codes. DAO has error codes ranging from 3000 to 3500, while ADO has error codes ranging from vbObjectError+3000 (decimal -2147218504) to vbObjectError+3800 (decimal -2147217704).

So the error you get from executing "DROP TABLE xxxx" depends on whether you execute it with DAO or ADO.
This will give you error 3376:
CurrentDb.Execute "DROP TABLE xxxx"
This will give you error -2147217865:
CurrentProject.Connection.Execute "DROP TABLE xxxx"
Both errors mean "Table does not exist"
__________________
Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
, Tapatalk


If this answer has helped, please click the Thanks button and/or click the 'reputation' scales symbol on the left and leave a comment. Cheers!
ridders is offline   Reply With Quote
Old 07-24-2017, 07:16 AM   #5
ridders
AWF VIP
Gold Supporter
 
ridders's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 2,923
Thanks: 54
Thanked 686 Times in 634 Posts
ridders has a spectacular aura about ridders has a spectacular aura about
Re: Access Error Codes

Thanks again Doc for explaining how you do the conversions.
Its so long since I needed to do this that I had forgotten how.

As can happen with moderated areas, I didn't see your reply to my PM before I posted.

I hadn't realised that the negative error codes were ADO.

For info, if you type something like this into the immediate window
Code:
 err.raise -2147352567
the error message is displayed complete with the hexadecimal equivalent with the first 8 characters already discarded

All 4 ADO errors that I included in post 1 are described as automation errors.

If anyone has a ready made function to convert these numbers to hex equivalents, it would be appreciated to save me reinventing the wheel

__________________
Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
, Tapatalk


If this answer has helped, please click the Thanks button and/or click the 'reputation' scales symbol on the left and leave a comment. Cheers!
ridders is offline   Reply With Quote
Reply

Tags
vba error codes

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Access VBA Crashes, No Error Codes sirhannick Modules & VBA 11 05-06-2015 09:33 AM
Error Codes phool4fool Forms 1 01-11-2012 03:13 PM
Error Codes chrisguk General 1 05-21-2011 09:53 AM
Access error codes GaelicFatboy General 3 01-24-2008 05:55 AM
Custom error codes TomJamieson Modules & VBA 2 11-24-2006 04:41 PM




All times are GMT -8. The time now is 01:47 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World