Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Instancing an Access Report from Delphi

Status
Not open for further replies.

ByzantianX

Programmer
Dec 18, 2000
103
Hello,
I'm totally new in this Delphi area and really need some help. I suppose this might be a totally beginner's problem: I would like to make an Access Report (Access 2000) and invoke it from Delphi project. Is that possible and how to do this? Thank you very much in advance!
 
Howdy,

Yes, it is possible, by connecting to Access through OLE. To do this you need to read more about the Access.Application class. (See your MSDN library or Microsoft Website). Below is some simple code to get you started.

Will work in Delphi 4.0 or above.

uses ComObj;

const
acPreview : Integer = 2;

<your procedure or function>
var
MSAccess : OLEVariant;
begin
MSAccess := CreateOLEObject('Access.Application');
MSAccess.OpenCurrentDatabase('c:\test.mdb');
MSAccess.Visible := True;
MSAccess.DoCmd.OpenReport('MyReport', acPreview);
end;

Like I said earlier, you really need to read more about the Access.Application class to be able to access it through Delphi or any other programming language.

Hope this helps and good luck.
WB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top