RSS Forums RSS
Please support our Pascal and Delphi advertiser: Programming Forums
Views: 2683 | Replies: 1
Reply
Join Date: Apr 2007
Posts: 1
Reputation: oglop44 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
oglop44 oglop44 is offline Offline
Newbie Poster

EOleSysError

  #1  
Apr 24th, 2007
I've written this program which at the mo only has two buttons. One to exit the program and the other to open a report from an external Microsoft Access database file. I'm getting this error message:

Debugger Exception Notification - Project Project1.exe raised exception class EOleSysError with message "Operation Unavailable". Process Stopped. Use Step or Run to continue.

Here's the code:
unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls,  ComObj;
type
  TForm1 = class(TForm)
    Label1: TLabel;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
implementation
 
{$R *.dfm}
 
procedure TForm1.Button1Click(Sender: TObject);
var
Access: Variant;
 const
    acViewNormal = $00000000;
    acViewDesign = $00000001;
    acViewPreview = $00000002;
begin
  try
    Access := GetActiveOleObject('Microsoft Access.Application');
  except
    Access := CreateOleObject('Access.Application');
  end;
  Access.Visible := True;
  Access.OpenCurrentDatabase('P:\ICT\Write\Computing\CPT L6\NEW CPT3\XmnrTable.mdb', True);
  Access.DoCmd.OpenReport ('Report 1', acViewPreview, EmptyParam, EmptyParam);
  Access.CloseCurrentDatabase;
  Access.Quit(1);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Application.terminate;
end;
end.

Any help would be much appreciated
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2006
Location: Romania
Posts: 171
Reputation: radu84 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 16
radu84 radu84 is offline Offline
Junior Poster

Re: EOleSysError

  #2  
Apr 24th, 2007
i haven't worked with ole, the only thing which i can suggest is the following tutorials

http://delphi.about.com/sitesearch.h...de=3176&type=1
http://delphi.about.com/sitesearch.h...de=3176&type=1

there you should find some answers

best regards,
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 9:14 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC