Access 2007 VBA: Error handler importing an Oracle table

B

Bernardo

Hi all !!!

I'm having a problem handling an error when importing an Oracle table
into Access 2007. The VBA code I'm using is something like this:


Sub ImportOracle()
Dim db As Database
Dim strSQL As String

On Error GoTo ErrHandler

strSQL = "SELECT * INTO ***** FROM
[ODBC;DSN=PeopleSoft;DBQ=*****;ID=*****;PWD=*****;].[PUBLIC.*****]"

Set db = CurrentDb
Call db.Execute(strSQL)

ExitPoint:
Set db = Nothing
Exit Sub

ErrHandler:
IOMsgDB "", "ERROR importing PeopleSoft (" & Err.Number & ": " &
Err.Description & ")"
Resume ExitPoint

End Sub

The problem is that if some reason the Oracle database is not
available, the process hangs with a window from the Oracle ODBC asking
for username and password (already filled). And only after accepting
that window, the code continues handling the error.

Does anybody know any way to avoid this?? Any help would be greatly
appreciated !!!

Thank you !!!
 

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

Top