Microsoft KB Archive/187297

= PRB: Run-time Error Message 3024 Using SQL and DAO Against Oracle =

Article ID: 187297

Article Last Modified on 8/11/2005

-

APPLIES TO


 * Microsoft Visual Basic 4.0 Standard Edition

-



This article was previously published under Q187297



SYMPTOMS
If you try to run Structured Query Language (SQL) against an Oracle database through Data Access Objects (DAO), you can encounter the following error:

Run-Time Error 3024

Couldn't find file C:\Program Files\DevStudio\VB\ .mdb.

This error occurs when you try to specify a schema name in your SQL statement and you use DAO with Oracle. The in the error message is whatever schema name you specified for the Oracle object you reference.



RESOLUTION
If you add the dbSQLPassThrough option to the OpenRecordset method, the sample code in the MORE INFORMATION section of this article runs without error. You can use brackets ([ ]) around the table name in the SQL string to avoid the error as well: sql = "SELECT * FROM [scott.emp]" Also, you can use an advanced data access technology, such as ActiveX Data Objects (ADO) to avoid this error.



STATUS
This behavior is by design.



MORE INFORMATION
The error message is generated because DAO tries to find an .mdb file in the local directory that matches the schema name you specified for the Oracle object in your SQL.

Sample Code
sql = "SELECT * FROM scott.emp" Set wks = Workspaces(0) Set con = wks.OpenDatabase("dseOracle", False, False, _   & "ODBC;UID=scott;PWD=tiger;") Set rss = con.OpenRecordset(sql, dbOpenSnapshot) This code generates the error because DAO tries to find the scott.mdb file.

