G'day folks, I've asked this question a little while ago but did not get any reply. There must be people out there having developed a Mail Merge utility. So if anybody could help me with this (either solving my question below, or having another approach) would be highly appreciated.
I'm using example code from http://www.djpate.freeserve.co.uk/AutoWord.htm providing an example on how to insert text into a Word document and how to create a mail-merge. The example uses a paradox example table (customer.db). This looks really great, however!!! 1. It works only when I remove 'DSN=Paradox Files;' in the connection string. SEE: ///Connection := Format('DSN=Paradox Files; 2. The defined WHERE clause is ignored, is shows all records! SEE: SQL := 'SELECT * FROM customer.db where Processed = ''n'''; Any ideas? Thanks a lot for any help. John ------------------------------------------------------------------ uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, {$IFDEF VER130} Word97, {$ELSE} Word_TLB, {$ENDIF} StdCtrls, Db, DBTables, Dialogs; type TMainForm = class(TForm) ... private Word: _Application; Doc : _Document; ... procedure TMainForm.GetDataSourceBtnClick(Sender: TObject); var TblName : string; Connection, SQL: OleVariant; begin { Open the customer table } TblName := AliasPath + '\' + 'customer.db'; if fileExists(TblName) then begin ///Connection := Format('DSN=Paradox Files; Connection := Format('DBQ=%s;DefaultDir=%s;DriverId=538;MaxBufferSize=2048;PageTimeout=5;' , [AliasPath, AliasPath]); SQL := 'SELECT * FROM customer.db where Processed = ''n'''; Doc.MailMerge.OpenDataSource(TblName, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, Connection, SQL, EmptyParam); --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/