LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
JPC JPC is offline
external usenet poster
 
Posts: 1
Default Excel 2007: OpenDatabase fails to connect to a SQL database

I have a problem with my excel add-in which works fine for earlier versions
of excel - but does not work properly with excel 2007. The OP system is
windows XP.

The code to connect is as follows:
Public cs_dbs As Database
Set cs_dbs = OpenDatabase(dbName, False, True, "ODBC;Regional=Yes")

When dbName is empty (as it will be for a new file), the user will be
prompted to select an ODBC source. After I select the source I get the
following error message: Cannot open MyDB database. Error: ODBC--connection
to 'MyDBSQL2005' failed.

If I look in the odbc trace log, I will eventually see the following error:
DIAG [S1000] [Microsoft][ODBC Driver Manager] General error: invalid window
handle.

Trying to connect to a Progress database, also ends in failure after I
select an odbc source. In this case I should see a window prompting me for a
password but I just get the error message that the operation was cancelled by
the user.

BUT: The following will work:
Public cs_dbs As Database
Stop
Set cs_dbs = OpenDatabase(dbName, False, True, "ODBC;Regional=Yes")

In debug mode, I can connect to both DB types. The odbc trace logs show no
errors.

It could be a bug in Excel 2007. This add-in works in earlier versions of
excel and works in debug mode in excel 2007.
AND if I open an existing excel sheet which already uses the add-in, then I
can connect without problems to the database. The DB is opened automatically
& formulas are refreshed.

Does anybody have any clue what is going wrong here? I hope I have provided
enough information.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to connect excel(If I consider it as a database) with a websit SATABDI NATH Excel Discussion (Misc queries) 0 July 8th 08 12:34 PM
Any sample to connect a remoted database through Excel Eric Excel Discussion (Misc queries) 0 May 9th 08 05:08 PM
How to connect Excel to stored procedures in SQL database? tskogstrom Excel Discussion (Misc queries) 1 July 3rd 07 09:40 AM
connect to access database and run a query in excel VBA Bob Excel Discussion (Misc queries) 0 April 25th 06 08:12 PM
connect a form to excel database Kathy Excel Discussion (Misc queries) 5 October 10th 05 06:17 AM


All times are GMT +1. The time now is 07:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"