Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Word Manipulation Through VFP
Message
De
10/08/1998 10:26:32
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00124749
Message ID:
00125244
Vues:
63
>>Kevin,
>>.insertdatabase(..) is the ODBC connection code. In word opening a new doc or changing active doc switches to another window. Have you looked or run the code ? If not run yet create the template c:\temp\prttest.doc (or change name to whatever you want in code also). Changing the link to source parameter to 1 would also link it to FoxData (here embedded).
>>Cetin
>>
>
>Cetin,
>I think I understand what you are doing but when I try to run the following code I get a mismatch error.
>
>oword = createobject("word.basic")
>oword.appshow && Show Word App - Word 7.0 Support
>oword.filenewdefault && New file, default template - Will create datasource
>cDSN = "DSN=Visual FoxPro Tables;UID=;PWD=;"
>cSourceDb = "SourceDB=C:\AMM\TEM12.DBF"
>cSourceType = ";SourceType=DBC;"
>cOther = "Exclusive=No;BackgroundFetch=No;Collate=Machine;"
>* Insertdatabase parms build here for clarifying
>* 35,511 are autoformatting options for grid - ignore
>* 0 Link to source false
>** The following line gives me the mismatch error
>oword.InsertDatabase(35,511,0,cDSN+cSourceDb+cSourceType+cOther,,,,,,,,,1)
>oword.filesaveas("c:\temp\xxmmergedoc",0) && Save as a word doc for mailmerge
>oword.fileclose(1) && Close saving
>* Datasource ready, now create mailmerge main document
>
>Any ideas?
Kevin,
If you wrote as is, where is SQL ? And cSourcedb should refer to DBC not dbf.
cSourceDb = "SourceDB=C:\Program Files\vfp50\SAMPLES\DATA\Testdata.dbc"
cSQLStatement = "SELECT recno() as rcno,* FROM customer"

.InsertDatabase(35,511,0, ;
	cDSN+cSourceDb+cSourceType+cOther, ;
	cSQLStatement,,,,,,,1)
If you don't use DBC (free tables) then it would be like :
cDefDir = sys(5)+curdir()
cDataFile = "mytable.dbf"
cDataFullPath = dbf(cDataFile)
cDSN = "DSN=FoxPro Files;DBQ="+cDefDir+";DefaultDir="+cDefDir+";"
cSourceDB = ""
cSourceType = ""
cOther = "DriverId=536;MaxBufferSize=512;PageTimeout=5;"
cSQLStatement = "SELECT * FROM "+cDataFile
	.InsertDatabase(35,511,0, ;
		cDSN+cSourceDb+cSourceType+cOther, ;
		cSQLStatement,,,,cDataFile,,,1)
PS: Word expects excl access to source. For that reason in class a tempfile is created.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform