Stephan Blind Guest
|
Posted: Sun Sep 19, 2004 10:04 am Post subject: Word Mailmerge |
|
|
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;
|
|