Access compatibility??

  • Thread starter Thread starter Tony
  • Start date Start date
T

Tony

Hello everyone,
I am using the Access.Application class in my program to import external
data from an excel spreadsheet to my access DB, it's working fine on any
system that has Office 2002 installed, but will throw an exception when it's
running on a machine that has Office 2000 on it... Does anyone know any way
to get around this?
Thanks in advance

Here is my piece of code:
Access.ApplicationClass access = new Access.ApplicationClass();
try
{
string dbPath = db.getDbPath();
string table = "tblBookTitle";
access.OpenCurrentDatabase(dbPath, false, "");

if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
string file = openFileDialog1.FileName.ToString();
access.DoCmd.TransferSpreadsheet
(Access.AcDataTransferType.acImport,
Access.AcSpreadSheetType.acSpreadsheetTypeExcel9, table, file, true, null,
null);
MessageBox.Show("Import Successful");
}
}
access.CloseCurrentDatabase();
access = null;
}
catch (Exception exc)
{
MessageBox.Show(exc.Message.ToString());
access.CloseCurrentDatabase();
access = null;
}
 
Tony> Hello everyone,
Tony> I am using the Access.Application class in my program to import external
Tony> data from an excel spreadsheet to my access DB, it's working fine on any
Tony> system that has Office 2002 installed, but will throw an exception when it's
Tony> running on a machine that has Office 2000 on it... Does anyone know any way
Tony> to get around this?

Use a the type library of Office 2000 when you develop.
 
Sorry.. but i really dunno which library is the Office 2000 library?
When i develop it, i use the Microsoft Access 10.0 Object Library in COM as
reference.

But where is the office 2000 library?
Thanks
Tony
 
Tony> Sorry.. but i really dunno which library is the Office 2000 library?
Tony> When i develop it, i use the Microsoft Access 10.0 Object Library in COM as
Tony> reference.

Access 10 = Access XP
Access 9 = Access 2000

Tony> But where is the office 2000 library?

You need to install Access 2000 to get that library.

Also, You can always use late-binding in your case. Search Microsoft KB
for late-binding. I believe there are some talking about this topic.

Tony> Thanks
Tony> Tony

Good luck!
 
Back
Top