Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OraOLEDB open crashing Access

Status
Not open for further replies.

adale

Programmer
Apr 18, 2001
48
0
0
GB
The following code attaches to an Oracle database to draw data into Access. It works about 25% of the time and crashes the rest. The crash is horrible as it doesnt show me an error message, but instead closes the database pops up a window saying "Microsoft Office Excel has encountered a problem and needs to close. We are sorry for the inconvenience."

The crash happens when 'rsADO.Open SQL, cnADO' executes. Any ideas what Access is up to, how to fix it, or how to get Access to tell me what it doesnt like rather than crashing?

MS Access 2003 SP2 running on XP Pro Ver2002 SP2
Here's the code....
Dim cnADO As ADODB.Connection
Dim rsADO As ADODB.Recordset

Set cnADO = New ADODB.Connection
Set rsADO = New ADODB.Recordset
cnADO.CursorLocation = adUseClient
cnADO.Mode = adModeShareDenyNone
cnADO.CommandTimeout = 0
cnADO.ConnectionString = "Provider=OraOLEDB.Oracle.1;Password='xxxx';Persist Security Info=True;User ID='xxxx';Data Source=ORACLE.SERVER"

cnADO.Open 'Open connection
Do 'Added to check state
Loop While cnADO.State = 0 'Added to check state

SQL = sqlGetData
KillSomeTime 15 'Added some stability
rsADO.Open SQL, cnADO

 
I didnt get a response to this one, but figured it out anyway.
The reason Access crashes is because it cant make sense of an error that was being generated when the recordset opens. If you should encounter such a frustrating situation as I've described, then take the SQL and check that it runs flawlessly in Oracle. In my case, the table I was querying had one field where the contents were being padded with spaces. It wasnt padded when I first built the query though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top