Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Data Source Name Not Found and No Default Driver
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Data Source Name Not Found and No Default Driver
Miscellaneous
Thread ID:
00761746
Message ID:
00761746
Views:
84
I have a Mail Merge routine in my VFP 6 SP3 app that 1) when the document is new it associates the data source, launches Word, performs the mail merge 2) when the document is not new it lauches Word and performs the mail merge. This works most of the time. But there are times when I get an error message "Data Source Name is not found and no default driver specified". When I click on the Details button I get "ODBD Error:[Microsoft][ODBC Driver manager] Data source name not found and no default driver specified. Sql State: IM002, Return Code: SQL_ERROR. It seems that I get this error maybe when I copy the Word documents (that already have the data source associated) from one client site to another. Not all clients have the same MDAC or the same configuration. Why does the data source get lost?

MY CODE

goWordApp = createobject("Word.Application")
word_directory = AddBs(JustPath(ctemplate_name))
goWordApp.ChangeFileOpenDirectory (word_directory)

if file(ctemplate_name)
goWordApp.Visible = .T.
goWordApp.documents.open(ctemplate_name)
gowordapp.Application.WindowState = 1
gowordapp.activewindow.windowstate = 3 &&maximized
if creccount != 0
gowordapp.activedocument.mailmerge.destination = 0
goWordApp.ActiveDocument.MailMerge.Execute
endif
else
goWordApp.Visible = .T.
gowordapp.Documents.Add
gowordapp.Application.WindowState = 1
gowordapp.activewindow.windowstate = 1 &&maximized
goWordapp.ActiveDocument.MailMerge.MainDocumentType = 0
goWordapp.ActiveDocument.MailMerge.OpenDataSource(cdatasource)
goWordapp.Activedocument.SaveAs(ctemplate_name)
endif
Reply
Map
View

Click here to load this message in the networking platform