BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Word Mailmerge

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
Stephan Blind
Guest





PostPosted: Sun Sep 19, 2004 10:04 am    Post subject: Word Mailmerge Reply with quote



Hi together,

I wrote a program changeing the Datasource of an word mailmerge
document
It is variable whether the datasource is an ACCESS-mdb or an
MSSQL-Database
I am using a connect-string, a SQL-Statement for selecting the right
table in the database. If I add a WHERE-clause to the SQL-statement it
wont work

would be very glad if anyone could help me
thanx
stephan

procedure TForm1.ButtonSource(Sender: TObject);
var filename,
readonly,
confirmconv,
addtorecentfiles,
linktosource,
emptystr,
emptyfalse,
myconnection,
mysql,
mysql1 : OLEVariant;
begin

try
filename := 'X:daten.mdb';

confirmconv := false;
readonly := false;
addtorecentfiles := false;
linktosource := true;
myconnection :=
'Provider=Microsoft.Jet.OLEDB.4.0;Password='''';User ID=Admin;Data
Source=\Server1HomeFirmaBüroEigene
DateienProjekteDBSupplyKWG18testSetDatenquelledaten.mdb;Mode=Read;Extended
Properties='''';Jet OLEDB:System database='''';Jet OLEDB:Registry
Path=''''';
mySQL := 'SELECT * FROM `adr1` WHERE Alter=13';
//mySQL := 'SELECT * FROM `adr1`';
mySQL1 := '';
emptystr := '';
emptyfalse := false;
wdApp.ActiveDocument.MailMerge.OpenDataSource ( filename,
emptyParam,
confirmconv,
readonly,
linktosource,
addtorecentfiles,
Emptystr,
Emptystr,
EmptyParam,
Emptystr,
Emptystr,
myconnection,
mysql,
mysql1 );
except
MessageDlg ( 'Error !!!!', mtError, [mbOk], 0 );
end;
end;
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.