Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Quoc Duong An
  
 Sai Gon - South Viet Nam
 
 Quoc Duong An
 To: Sunil Sawant
  Where is Sunil Sawant?
 Mumbai
 India
 Sunil Sawant
 Tags
Subject: RE: Sir Yuri, Please Help Me : General ODBC Error
Thread ID: 78537 Message ID: 78921 # Views: 2 # Ratings: 0
Version: Visual FoxPro 6 Category: ODBC, ADO and OLEDB
Date: Tuesday, October 11, 2005 6:22:09 AM         
   


> Hi Paul,
>
> As I stated earlier that I have modified the original code respectively. And original code is an example given by Mr.Yuri Rubinov, so respective modification is needed in the code.
>
> Secondly, 'into table ' is valid sql syntax, I dont think so problem is occurring because of it. In an error its clearly mentioned “OLE Idespatch Exception code 0 from Microsoft Excel. General ODBC error” .
>
>
> Regards
> Sunil.
>
>
> > This is just a guess after a cursory glance at the two sets of code but in your SQL statement you have 'INTO TABLE tmpFeed' where the original doesn't select into anything.
> >
> > HTH
> > Paul
> >
> > > 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

>
>
>
> Nobody is perfect I'm nobody


Hi Sunil
I think your sqlstring has a problem. Try another solution. For example, make sure your selection from main table into dest_table is OK. The second step is export to excel. There're somethings for you.

tmpsheet = GetObject('','excel.sheet')
XLApp = tmpsheet.application
*---- Where to export to -------
lcFILE_S= 'EXPORT.XLS'
lcFILE_S= FULLPATH(lcFILE_S)
XLApp.Workbooks.Open(lcFILE_S)
XLApp.ActiveWindow.WindowState= -4137 && xlMaximized
XLApp.Visible = .T.

XLSheet = XLApp.Sheets(1)

*------- Scan the main to add row to row
scan
XLSheet.Range('A1').EntireRow.Insert
FOR j = 1 to FCOUNT()
lcCOL= FIELD(j)
XLSheet.Range('A1').Offset(-1, j - 1).Value= Alltrim(&lcCOL)
ENDFOR
ends

Try it. OK?
Good luck
daquoc

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