Art Delphi Automation History Home Politics Email me Default Colours Printable Colours
|
see also the
Access main page
|
||
When I try to import the type library, I just get a warning about TControl being already registered
Instead of importing the type library in the usual way, use the TLibImp.exe utility in the Delphi4\Bin folder to generate the Access_TLB.pas and other files.
When I include Access_TLB in my project's uses clause, the compiler reports lots of errors.
The DAO, Office and Access TLB.pas files generated from MSAcc8.olb use rather a lot of Object Pascal reserved words as parameter names, such as Object, Type, and To. You can rename these, perhaps by prefixing an underscore. You may also find a few cases where a parameter name has been missed out, and you have to insert a name (e.g. 'Index').
I get an EOleSysError exception when I try to start Access!
You probably have 'Break on exceptions' set to true in the Delphi IDE. You can change this (using the Tools|Debugging|Language Exceptions menu in D4), or you can use code that avoids throwing an exception if Access is not open - see Opening Access (early binding).
My program always creates a separate instance of Access. How can I use the running instance?
Use GetActive Object or GetActiveOleObject - see How to start Access for examples.
I'm using the D5 server components, but there isn't one for the Access application object!
Well, there is if you get the patch for Delphi 5. But if you haven't yet got the patch, don't worry — you can use an Access _Application variable to start Access, like this:
uses Access97; var Access: _Application; ... Access := CoApplication.Create; Access.Visible := True;And then connect the Access components in the normal way, like this:AccessForm1.ConnectTo(Access.Forms[0]); // Assumes a form is open AccessForm1.Caption := 'Oh when, oh when will my Delphi patch come?';
The project stops at the Application.Initialize line, with the message 'Object or class type required'
The Application interface declared in the Access_TLB.pas file causes this problem - you need to ensure that Delphi knows when to use the global Application object, declared in the Forms unit. Edit the lines in the project.dpr, like this:
Forms.Application.Initialize; Forms.Application.CreateForm(TForm1, Form1); Forms.Application.Run;