By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,475 Members | 1,083 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,475 IT Pros & Developers. It's quick & easy.

Access compatibility??

P: n/a
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;
}
Nov 15 '05 #1
Share this Question
Share on Google+
3 Replies

P: n/a
>>>>> "Tony" == Tony <li***********@hotmail.com> writes:

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.

--
Peter Wu
Powered by Microsoft Windows XP [Version 5.1.2600]
Nov 15 '05 #2

P: n/a
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
Nov 15 '05 #3

P: n/a
>>>>> "Tony" == Tony <li***********@hotmail.com> writes:

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!

--
Peter Wu
Powered by Microsoft Windows XP [Version 5.1.2600]
Nov 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.