473,396 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

trap odbc errors

Hi!

I have to use MS-Access2000 as a frontend for an oracle database. And
I dont want to see these ORA-xxxx Popups if an error occures.
So I use something like the following in access (it should work with
sql-server....):

Private Sub Form_Error(DataErr As Integer, Response As Integer)
Dim errX As DAO.Error

If Errors.Count > 1 Then
For Each errX In DAO.Errors
Debug.Print "ODBC Error"
Debug.Print errX.Number
Debug.Print errX.Description
Next errX
end if
End Sub

But I always get Errors.Count=0 :-(
Oracle is version 9.

What is wrong ?
What can I do, to get the oracle-error-number - or better the full
error-description from the popup?
Thanks,
Detlev
Nov 12 '05 #1
3 4046
The universal solution is a real pain, and making the solution work in Access
2000 is a bigger pain because the example code from Microsoft will not behave
right without significant tweaking. Access 97 and 2002 handle it much better.

Basically, what you have to do is trap the BeforeUpdate and Delete events on
the form, grap the data from the bound controls on the form, then perform the
Add, Update, or Delete on the form's RecordsetClone, and Cancel the original
action. Since the recordset action happens in VB code, you can do normal
error trapping to get the error details.

Now, that said, there's a simpler solution - don't allow any add/edit/delete
through a bound form. Use unbound forms instead. This is a paid too, though,
because that means no editing in continuous forms, and that includes
continuous subforms. I suppose you could have continuous forms bound to local
temporary data tables, and copy data back and forth to the server. You'd need
to copy data to the temp data table when it's time to display it in the
subform, and either post changes back to the server after each row update or
use a sequence of of a delete, update, and insert query to post changes back
to the server as a batch. The pain here is that you need to implement your
own Optimistic or Batch Optimistic locking scheme.

On 13 May 2004 07:04:31 -0700, da*******@web.de (Detlev Ahlgrimm) wrote:
Hi!

I have to use MS-Access2000 as a frontend for an oracle database. And
I dont want to see these ORA-xxxx Popups if an error occures.
So I use something like the following in access (it should work with
sql-server....):

Private Sub Form_Error(DataErr As Integer, Response As Integer)
Dim errX As DAO.Error

If Errors.Count > 1 Then
For Each errX In DAO.Errors
Debug.Print "ODBC Error"
Debug.Print errX.Number
Debug.Print errX.Description
Next errX
end if
End Sub

But I always get Errors.Count=0 :-(
Oracle is version 9.

What is wrong ?
What can I do, to get the oracle-error-number - or better the full
error-description from the popup?
Thanks,
Detlev


Nov 12 '05 #2
Detlev Ahlgrimm wrote:
Hi!

I have to use MS-Access2000 as a frontend for an oracle database. And
I dont want to see these ORA-xxxx Popups if an error occures.
So I use something like the following in access (it should work with
sql-server....):

Private Sub Form_Error(DataErr As Integer, Response As Integer)
Dim errX As DAO.Error

If Errors.Count > 1 Then
For Each errX In DAO.Errors
Debug.Print "ODBC Error"
Debug.Print errX.Number
Debug.Print errX.Description
Next errX
end if
End Sub

But I always get Errors.Count=0 :-(
Oracle is version 9.

What is wrong ?
What can I do, to get the oracle-error-number - or better the full
error-description from the popup?


Loop the DBEngine.Errors collection.

--
Error reading sig - A)bort R)etry I)nfluence with large hammer
Nov 12 '05 #3
On Thu, 13 May 2004 18:25:53 +0100, Trevor Best <nospam@localhost> wrote:
Detlev Ahlgrimm wrote:
Hi!

I have to use MS-Access2000 as a frontend for an oracle database. And
I dont want to see these ORA-xxxx Popups if an error occures.
So I use something like the following in access (it should work with
sql-server....):

Private Sub Form_Error(DataErr As Integer, Response As Integer)
Dim errX As DAO.Error

If Errors.Count > 1 Then
For Each errX In DAO.Errors
Debug.Print "ODBC Error"
Debug.Print errX.Number
Debug.Print errX.Description
Next errX
end if
End Sub

But I always get Errors.Count=0 :-(
Oracle is version 9.

What is wrong ?
What can I do, to get the oracle-error-number - or better the full
error-description from the popup?


Loop the DBEngine.Errors collection.


The Errors collection is an alias to DBEngine.Errors, and neither one turns
out to work for getting ODBC errors in a Form's Error event handler.
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Steve | last post by:
I normally use MySQL with PHP, but I'm delving into connecting to Access with ODBC (for a database that I already have set up at work), and I'm running into a couple of errors. I'm just trying to...
11
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows...
2
by: Lyn Duong | last post by:
hi all, I am trying to create a dts package to transfer data from tables in my sql server 2000 database to a db2 UDB v8.1.4 database. When I use ibm db2 oledb driver for the destination this...
3
by: Eitan | last post by:
Hello, I want to emphasize a point for my prior posts : How can I trap a message in ASP (not dotnet), to a specific label. (I know : on error goto my_label ... but this does not work in ASP...
3
by: Jason Gyetko | last post by:
I'm running DB2 v8.1 FP5 and am trying to link tables via ODBC from Access 2002 to my DB2 database. Access lets me connect to the database and returns a list of all tables I can select from, but...
7
by: tina | last post by:
Hello, Can you hale me to define my mistake please? I am trying to run a SQL Pass – Through Query from Access 2000 and inside the record set I am trying to loop for a LoginID. I think that this...
1
by: VBSponge | last post by:
Hi all. Need help here as I cant see whats wrong... I have a querydef in Access 2k which execs a stored proc in a SQL Server 2k db. I keep getting the following error, and cant stop it for the...
4
by: Phil Latio | last post by:
Scenario is: We have an intranet on which a Helpdesk application can be accessed. Data input into the Helpdesk is stored in a Access 2000 database, held on a server. This is great, works fine,...
2
by: ramu | last post by:
Hi, I read the phrase " trap representation" in the topic "Union arrangement" in this group. Can you please tell me what do you mean by it? regards
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.