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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC query works in Access 97 but not in 2000

Status
Not open for further replies.

MrBill2

Programmer
Sep 24, 2001
2
US
I am moving an Access 97 database to Access 2000. Everything looks good except for Combo Boxes which were previously populated from ODBC queries. Looks like an old trick no longer works and I'm looking for a workaround.

The code below is called from a form named "testit" and a Combo Box named PartNumber is automatically populated with the results of an Oracle query. This works nicely in Access 97. Under Access 2000, there is a long delay as if it is trying to talk to Oracle. Then, the following error is displayed:

&quot;The record source ‘SELECT DISTINCT Part_Num, Part_Desc FROM [Public.Part_MASTER] IN ‘’ ‘ODBC;DSN=Oracle 32bit ORAP;UID=username;PWD=userpwd;DBQ=PRODDB’ WHERE Part_Num <> Null ORDER BY Part_Num’ specified on this form or report does not exist.

You misspelled the name, or it was deleted or renamed in the current database, or it exists in a different database.

In the Form or Report’s Design view, display the property sheet by clicking the Properties button, and then set the RecordSource property to an existing table or query.&quot;

Any ideas for making this code under Access 2000? This seems most puzzling.

Bill

P.S. Forgive the formatting below. I'm new to this site and it looks horrible in my browser!

Code:
Function testit() As Integer
Dim ConnectString As String
Dim ODBCConnection As connection
Dim strParts As String
Dim wrkODBC As workspace

Set wrkODBC = CreateWorkspace(&quot;NewODBCWorkspace&quot;, &quot;admin&quot;, &quot;&quot;, dbUseODBC)
Set ODBCConnection = wrkODBC.OpenConnection(&quot;Oracle 32bit ORAP&quot;, dbDriverNoPrompt, , &quot;ODBC;DSN=Oracle 32bit ORAP;UID=username;PWD=userpwd;DBQ=PRODDB&quot;)
ConnectString = &quot;ODBC;DSN=Oracle 32bit ORAP;UID=username;PWD=userpwd;DBQ=PRODDB;&quot;
strParts = &quot;SELECT DISTINCT Part_Num, Part_Desc FROM [Public.Part_MASTER] IN '' '&quot; & ConnectString & &quot;' &quot; & &quot;WHERE Part_Num <> Null ORDER BY Part_Num&quot;
Forms(&quot;testit&quot;).PartNumber.RowSource = strParts

End Function
 
Turns out the code will work on another installation of Access 2000 and appears to be driver related.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top