Automating Access

Greetings

I have tried to generate an Access report from D5  using COM/OLE.  The
following code was taken from DJPate's web page (Many thanks to her!).
However, it doesn't work.
Compilation errors occur with CLASS_Application & CoApplication not being
declared.
Am I doing something wrong, or overlooking something.
The one thing I haven't done is imported MSacc8.olb and put Access_TLB.PAS
into the uses clause.  Is that it?, or is there something else....

Many thanks,

Jim Hock

{  Var
   Access : _Application;
   AppWasRunning : Boolean;
   UnKnown : IUnKnown;
   Result  : HResult;

begin
  AppWasRunning := False;
  Result := GetActiveObject(CLASS_Application, nil, Unknown);
  if (Result = MK_E_UNAVAILABLE) then
    Access := CoApplication.Create
   else begin
    OleCheck(Result);
    OleCheck(Unknown.QueryInterface(_Application, Access));
    AppWasRunning := True;
    end;

  Access.Visible := True;

Quote
}