G'day folks, 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);
<<attachment: winmail.dat>>