Solved

ODBC error in Windows 7 (Not in XP)

Posted on 2011-03-25
5
978 Views
Last Modified: 2012-05-11
I am getting the following error while try to read a recordset:
"ODBC driver does not support the requested properties."

I am running vb6 code on Windows 7 with SQL 2008.
This code has run fine in XP and SQL 2005 and there are literally 100's of similar statements in the project (many using the same connection) which work just fine. The pertinent lines are:

When the project is opened, the following are declared (the gdb.version is 6.1):

Dim gDB As ADODB.Connection
Dim gDBCmd As New ADODB.Command

    Set gDB = New ADODB.Connection
    gDB.Open “DSN=<Sql DSN Data Source>;UID=sa;PWD=<Password>”
    Set gDBCmd.ActiveConnection = gDB


This is the procedure where the error occurs:
   
Dim rsStore As New ADODB.Recordset

    gDBCmd.CommandText = “Select <FieldName1> From <TableName> Where <FieldName2> = 1”
    Set rsStore = gDBCmd.Execute <-- error occurs

Thanks for any help you can give
0
Comment
Question by:CASorter
  • 2
  • 2
5 Comments
 
LVL 10

Expert Comment

by:Hutch_77
Comment Utility
Having had somethign similar but not positive this is correct I will pass it up.  Is this supposed to be a 32 bit ODBC connection?

If you are running 64 bit Win 7 you are settin gup a 64 bit ODBC connection and you need it setup in 32 bit mode by running this :

C:\Windows\SysWOW64\odbcad32.exe

If it is not an ODBC issue I am not sure.
0
 

Author Comment

by:CASorter
Comment Utility
I am running 32 bit win 7 and 32 bit ODBC
0
 
LVL 2

Expert Comment

by:SushiFrito
Comment Utility
Try to replace the Early Binding to Late Binding

Dim gDB As Object   'ADODB.Connection
Dim gDBCmd As Object   'New ADODB.Command

Set gDB = CreateObject("ADODB.Connection")
Set gDBCmd = CreateObject("ADODB.Command")
0
 
LVL 2

Accepted Solution

by:
SushiFrito earned 500 total points
Comment Utility
Try to replace the Early Binding to Late Binding

Dim gDB As Object   'ADODB.Connection
Dim gDBCmd As Object   'New ADODB.Command

Set gDB = CreateObject("ADODB.Connection")
Set gDBCmd = CreateObject("ADODB.Command")
0
 

Author Closing Comment

by:CASorter
Comment Utility
Thanks,
Any idea why this works? I never used late binding before
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now