Articles   Members Online: 3
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to work with reports in MS Access Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
Work with reports in MS Access 03-Jun-03
Category
ADO/OLE-DB
Language
Delphi 2.x
Views
152
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Mike Shkolnik

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: 
1   
2   var
3     Access: Variant;
4   begin
5     // open the Access application
6     try
7       Access := GetActiveOleObject('Access.Application');
8     except
9       Access := CreateOleObject('Access.Application');
10    end;
11    Access.Visible := True;
12  
13    // open the database
14    //The second parameter specifies whether you want to open the database in 
15  Exclusive mode
16  
17    Access.OpenCurrentDatabase('C:\My Documents\Books.mdb', True);
18  
19  // open the report
20  {The value for the second parameter should be one of
21  acViewDesign, acViewNormal, or acViewPreview. acViewNormal, which is the default, 
22  prints the report immediately. If you are not using the type library, you can 
23  define these values like this:
24  
25  const
26  acViewNormal = $00000000;
27  acViewDesign = $00000001;
28  acViewPreview = $00000002;
29  
30    The third parameter is for the name of a query in the current
31    database.The fourth parameter is for a SQL WHERE clause - the string must be valid
32    SQL, minus the WHERE.}
33  
34    Access.DoCmd.OpenReport('Titles by Author', acViewPreview,
35      EmptyParam, EmptyParam);
36  
37    { ... }
38      // close the database
39    Access.CloseCurrentDatabase;
40  
41    // close the Access application
42      {const
43        acQuitPrompt = $00000000;
44        acQuitSaveAll = $00000001;
45        acQuitSaveNone = $00000002;}
46    Access.Quit(acQuitSaveAll);
47  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC