Access compatibility??

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tony

    Access compatibility??

    Hello everyone,
    I am using the Access.Applicat ion 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.Applicat ionClass access = new Access.Applicat ionClass();
    try
    {
    string dbPath = db.getDbPath();
    string table = "tblBookTit le";
    access.OpenCurr entDatabase(dbP ath, false, "");

    if (openFileDialog 1.ShowDialog() == DialogResult.OK )
    {
    string file = openFileDialog1 .FileName.ToStr ing();
    access.DoCmd.Tr ansferSpreadshe et
    (Access.AcDataT ransferType.acI mport,
    Access.AcSpread SheetType.acSpr eadsheetTypeExc el9, table, file, true, null,
    null);
    MessageBox.Show ("Import Successful");
    }
    }
    access.CloseCur rentDatabase();
    access = null;
    }
    catch (Exception exc)
    {
    MessageBox.Show (exc.Message.To String());
    access.CloseCur rentDatabase();
    access = null;
    }


  • Peter Wu

    #2
    Re: Access compatibility??

    >>>>> "Tony" == Tony <liquid__snake@ hotmail.com> writes:

    Tony> Hello everyone,
    Tony> I am using the Access.Applicat ion 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]

    Comment

    • Tony

      #3
      Re: Access compatibility??

      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


      Comment

      • Peter Wu

        #4
        Re: Access compatibility??

        >>>>> "Tony" == Tony <liquid__snake@ 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]

        Comment

        Working...