Excel Access using DAO Jet Engine?

Excel Access using DAO Jet Engine?

Post by Vincent Armat » Tue, 26 Aug 1997 04:00:00



 I have heard that one can user the Jet Engine to populate an Excel
spreadsheet using much of the same code that could be used to populate an
Access table.  Is this correct?

Is there any good documentation on how to code this?  I have checked
Microsoft's site thoroughly, but it seems that wherever I find the word
'Jet', Access seems to follow immediately behind it.

Thanks,

 - Vince Armato

 
 
 

1. Using the DAO Jet Engine object

My users like Access 7.0, I like to develop in Delphi.  I am also very
familiar with DAO objects through VB.

I started trying to read the Access DB by declaring a variant
variable and creating an OLE object "DAO.DBEngine".

I can read some properties of my DB, so I know the object is being created properly,
but I can't reference the fields in the tables.

The error returned is:  "Method 'Field' not supported by OLE Object" or
   "Operation not supported for this type of object".

Here is the sample code (the app is a console app which explains the writeln):

        var
                myDAO, mydb, myTable : Variant;

        begin
                myDAO := CreateOleObject ('DAO.DBEngine');
                mydb := myDAO.OpenDatabase ('theDB.mdb');
                myTable := mydb.OpenRecordSet ('theTable');

                //this works
                writeln ('DAO Value is ', myTable.Fields.Count);

                //this causes the exception: "Method 'Field' not supported by OLE object"
                writeln ('Field value is ', myTable.Field(0));

                //this also causes an exception: "Operation not supported by this OLE object"
                writeln ('Field value is ', myTable.Fields('ID'));

        end.

Any suggestions?  I would think this approach is feasible, perhaps not optimal.
Feel free to comment on the efficiency of this approach versus ODBC.

Thanks much,

Rob Maxwell
NetGram Inc.

2. DBA 8i - passing score

3. Using the DAO Jet Engine Object?

4. Urgent. Need MSVBVM60.DLL please.

5. Accessing a password protected Access 97 database using the Jet Engine

6. Does the use of VFP DBC always makes sense?

7. Problems with linking to access database using Jet engine

8. Create Index on View

9. Using Crystal reports with Access 2.5 JET Engine

10. Converting JET 3.51(97) To Jet 4.0(2000) Using DAO In VB 5

11. Using ADO and Jet 4.0 to access data in Excel

12. DAO is not updating dynaset via db-control with databases used with access jet 2 layer

13. Sort and Find/Seek (Using VB 5, DAO, JET, Access)