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

VB6 ODBC Connection under Windows 7

Status
Not open for further replies.

ianwin

Programmer
Jul 5, 2005
44
US
Hi,

I am trying to get a VB5 app which uses a workspace to run the following ODBC connection

Code:
Global ODBC_WS as Workspace
Global ODBC_DB as Connection

set ODBC_WS = CreateWorkspace ("","", dbUseODBC)
set ODBC_DB = ODBC_WS.OpenDatabase("", dbDriverComplete, False, "ODBC;DSN=[i]DSN[/i];UID=[i]user[/i];PWD=[i]PASSWORD[/i]")

This works without issue when run in the IDE however after compiling and running the exe the Set ODBC_DB line fails with error message "ODBC call Failed"

There are no other dependant files and I have tried recreating the DSN and deleting the old exe before recompiling none of which work.

Any advice would be greatly appreciated.

-Ian
 
I have read there are some problems with compiling a VB6 app on Win7, The exe may not run everything on a previous OS like XP.
I keep an old drive with XP on it and boot up on use this when developing. I haven't had any problem with compiling on XP and running in Win 7 except you can't use any old 16 bit Activex's
 
First thing to check is if your app is 32 or 64 bit, and is the Windows 7 version 32 bit or 64 bit.

A 32 bit app needs the 32 bit odbc connection on a 64 bit version of windows. Don't use the control panel ODBC connector. There is a 32 bit ODBC setting under the C:\Windows\SysWOW64\odbcad32.exe and you have to use that to configure any 32 bit connections.

Bruce Ferguson
 
Thanks for the feedback, The app and windows installation are both 32 bit. I have since identified that this issue was realted to ODBC linked tables used in a local MS Access database which is also accessed by this application. By using a version of the database stored in the application directory with the deployment I have been able to resolve this issue.

Thanks all for the assistance.

-Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top