delphi3000.com - the free delphi knowledge platform
delphi3000.com - the free delphi knowledge platform
Have a look at your member-status

connecting people's knowledge


  - Recent ArticlesRSS feed for Recent Articles on delphi3000.com
  - List of All Articles
  - Top Viewed Articles
  - Articles (+Attachem.)
  - Articles Of Interest
  - Categories
  - Top Uploader
  - Search
  - Index

  - My Home
  - Submit an Article
  - My Articles
  - My Personal Data
  - My Bookmarks
  - Activities
  - Login/Logout

  - Sign Up
  - Why Sign Up
  - Newsletter

  - Press
  - Advertise

  - Contact
  - Feedback



Community
Borland
ClubeDelphi
Dr. Bob
UK-BUG
Delphi Meetings
Planeta Delphi








Share this article with friendsShare this article with friends
Rate this articleRate this article - to keep the quality of delphi3000.com !
Comment this article or read through previous comments (1)


Work with reports in MS AccessGo to Mike Shkolnik's websiteFormat this article printer-friendly!Bookmark function is only available for registered users!
print/preview the MS Access`s report
Product:
Delphi all versions
Category:
OLE
Skill Level:
Scoring:
Last Update:
06/06/2000
Search Keys:
delphi delphi3000 article borland vcl code-snippet MS-Access Report Preview Print OpenReport Access.Application
Times Scored:
8
Visits:
9511
Uploader: Mike Shkolnik
Company: Scalabium Software
Reference: N/A
 
Question/Problem/Abstract:
How I can open a report (in Print Preview mode and also print direct) in an MS Access database?
Answer:



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;





Please rate this article!
Skill level:
BeginnerExpert

Useful:
No!Very!

Overall rating:
PoorExcellent



Comments to this article
Write a new comment
some limits...
    Diego Muñoz (Apr 24 2001 9:54AM)

very fancy but,
.-How to hide the database window?
.-And the menu?
the idea is simply show de report, not allowing the user any other option,
after all, it's called from a Delphi app.
Respond














 
Sign up to consume product discounts for Bronze memberships !

read more


   


  Community Ad of
S. Carter
 
   














 







     
  Copyright © 2000 - 2007 delphi3000.com - All rights reserved. Terms of use. || Privacy
delphi3000.com is a service by bluestep.com IT-Services GmbH (Vienna)