Статьи по программированию
примеры программного кода
Delphi, Kylix, C, C++, SQL, Visual Basic, Bash, Assembler, 1С
Qt, KOL, MFC, Rx Library, Windows, Linux, Mac OS
Примеры работы с репортами
Опубликовано codeLocker в 24.07.2008 в 13:58.
In the next small example I'll demonstrate how you can call the report in MS Access:
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:\My Documents\Books.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('Titles by Author', acViewPreview,
EmptyParam, EmptyParam);
{ ... }
// close the database
Access.CloseCurrentDatabase;
// close the Access application
{const
acQuitPrompt = $00000000;
acQuitSaveAll = $00000001;
acQuitSaveNone = $00000002;}
Access.Quit(acQuitSaveAll);
end;
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:\My Documents\Books.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('Titles by Author', acViewPreview,
EmptyParam, EmptyParam);
{ ... }
// close the database
Access.CloseCurrentDatabase;
// close the Access application
{const
acQuitPrompt = $00000000;
acQuitSaveAll = $00000001;
acQuitSaveNone = $00000002;}
Access.Quit(acQuitSaveAll);
end;
Материал похожий на Примеры работы с репортами
- Как можно открыть отчёт (в режиме Print Preview а также print direct) в MS Access ?
- Пример шифрования данных
- Проблемы с TCanvas.StretchDraw при рисовании иконок
- Примеры использования Drag and Drop для различных визуальных компонентов
- Проблема всплывающих подсказок в дочерних MDI-формах
Метки
delphi работа с access примеры c sql report current sql instr sql
Навигация
Сейчас на сайте
Сейчас на сайте 0 пользователей и 1 гость.
Статистика
Всего материалов: 1387