Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Sunil Sawant
  Where is Sunil Sawant?
 Mumbai
 India
 Sunil Sawant
 Tags
Subject: Sir Yuri, Please Help Me : General ODBC Error
Thread ID: 78537 Message ID: 78537 # Views: 1 # Ratings: 0
Version: Visual FoxPro 6 Category: ODBC, ADO and OLEDB
Date: Wednesday, October 05, 2005 9:21:35 AM         
   


Dear Sir Yuri,

I’m facing problem while exporting the dbf file to .xls. The file contains one memo field and when I’m exporting the file to xls, memo fields is not getting exported to xls . So I searched for the help on this forum. And I find your reply to thread no 21264 of Mr. Terrence Ho. In reply to this thread you have written code to export the file to xls with memo field. The code is here

ObjExcel= CREATEOBJECT("Excel.Application")
ObjExcel.Workbooks.add()
ConnectionString="ODBC;DSN=Visual FoxPro Tables;UID=;PWD=;SourceDB=c:\foxwork\vfpapps;SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;"
sqlquery="SELECT memofield, otherfields from syserr"
ObjExcel.ActiveSheet.QueryTables.Add(;
ConnectionString,;
ObjExcel.ActiveSheet.Range("A1"),;
sqlquery).Refresh

I copied it and tried to use it in my application with the respective modifications. However, its not working. When I’m running the form it shows the error
“OLE Idespatch Exception code 0 from Microsoft Excel. General ODBC error”
Sir, can you please help me know as to why this error is occurring. I would like to make one thing clear here that I’m not using table from DE. Is this the reason why error occurring? Here is the modified code for your information.

sele 0
use data\main alias main shared

ObjExcel= CREATEOBJECT("Excel.Application")
ObjExcel.Workbooks.add()
ConnectionString="ODBC;DSN=Visual FoxPro Tables;UID=;PWD=;SourceDB=D:\foxwork\vfpapps;SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;"
sqlquery="SELECT main.desc, main.sra_feed,main.id, main.name,main.tmename from MAIN Where main.tmename=curname into table tmpfeed "
ObjExcel.ActiveSheet.QueryTables.Add(;
ConnectionString,;
ObjExcel.ActiveSheet.Range("A1"),;
sqlquery).Refresh

Sir, Can you please help me to know the what mistake I have done ?

Thanks a lot in advance.

Sunil
Nobody is perfect I'm nobody

ENTIRE THREAD

Sir Yuri, Please Help Me : General ODBC Error Posted by Sunil Sawant @ 10/5/2005 9:21:35 AM
RE: Sir Yuri, Please Help Me : General ODBC Error Posted by Paul Brown @ 10/5/2005 9:49:47 AM
RE: Sir Yuri, Please Help Me : General ODBC Error Posted by Sunil Sawant @ 10/5/2005 11:04:28 AM
RE: Sir Yuri, Please Help Me : General ODBC Error Posted by An Quoc Duong @ 10/11/2005 6:22:09 AM
RE: Sir Yuri, Please Help Me : General ODBC Error Posted by Sunil Sawant @ 10/11/2005 10:42:38 AM
RE: Sir Yuri, Please Help Me : General ODBC Error Posted by An Quoc Duong @ 10/12/2005 3:48:12 AM
RE: Sir Yuri, Please Help Me : General ODBC Error Posted by Yuri Rubinov @ 10/5/2005 5:43:11 PM
RE: Sir Yuri, Please Help Me : General ODBC Error Posted by Sunil Sawant @ 10/6/2005 7:49:08 AM
RE: Sir Yuri, Please Help Me : General ODBC Error Posted by Sunil Sawant @ 10/6/2005 11:16:49 AM