Печать/просмотр отчета MSAccess

uses comobj;

procedure tform1.button1click(sender: tobject);
var
access: variant;
begin
{open the access application}
try
access := getactiveoleobject('access.application');
except
access := createoleobject('access.application');
end;
access.visible := true;

{ open the database
the second parameter specifies whether you want to open the
database in exclusive mode}
access.opencurrentdatabase('c:test.mdb', true);

{ open the report
the value for the second parameter should be one of
acviewdesign, acviewnormal, or acviewpreview. acviewnormal, which is the
default, prints the report immediately. if you are not using the type
library, you can define these values like this:

const
acviewnormal = $00000000;
acviewdesign = $00000001;
acviewpreview = $00000002;

the third parameter is for the name of a query in the current
database. the fourth parameter is for a sql where clause - the string must
be valid sql, minus the where.}
access.docmd.openreport('a report name', 2, emptyparam, emptyparam);

{close the database}
access.closecurrentdatabase;

{close the access application}
{const
acquitprompt = $00000000;
acquitsaveall = $00000001;
acquitsavenone = $00000002;}
access.quit(1);
end;

Источник: http://www.swissdelphicenter.ch



Опубликовал admin
7 Ноя, Вторник 2006г.



Программирование для чайников.