none
OLEDB code RRS feed

  • Question

  • I am trying to upgrade from Access 98 to Access 2007 and need the Connection Code for .accdb database. Thanks to Albert it is Access 97. I inherited working this website about 10 years ago and it was originally copied from a commercial site. I redid the site about 4 years ago without changing the database.

    Also I would like to try and just go to an Access 2016 database and will do that if I can get the Connection Code.

    Here is more info that would explain it better. Following is the code used to open connection to dxxxxxxxx.mdb 

    'Open connection
    set ConnObj = server.CreateObject("ADODB.Connection")
    ConnObj.Open "dxxxxxxxx"
    set RstObj = server.CreateObject("ADODB.Recordset")
    RstObj.Open "Select distinct(icat) from items order by icat", ConnObj

    'get catagory information
    catagory = request("cat")

    I am currently using Office 2016 to connect to Access and Dreamweaver CS6 to website work.

    Jim


    • Edited by Diego Don Thursday, November 2, 2017 12:17 AM
    Wednesday, November 1, 2017 12:37 AM

All replies

  • Ok, somewhat minor, but there was only a access 97 version, not 98.

    You also might want to expand on what software you using to connect to Access.

    As a general rule, the connection will use:

    Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccessFile.accdb;
    Persist Security Info=False;

    However, if you talking about VBA code inside of Access, then you don’t need to use the above connection, but can use the internal one:

    Eg:

    currentproject.Connection

    Regards,
    Albert D. Kallal (Access MVP, 2003-2017)
    Edmonton, Alberta Canada

    Wednesday, November 1, 2017 1:23 AM
  • Thanks for helping, I have added clarification to the problem with answers to some of your questions.

    Jim

    Thursday, November 2, 2017 12:18 AM
  • If you using the mdb format, then you can continue to use the older “default” of ADO, and your past use of

    ADODB.CConnection.

    You not really using Access at all, but only the database engine that Access “also” uses.

    However, what will come into plane is if your web site is x64 bits. That means the JET database engine will have to match the bit size of your web server.

    So with what you given so far, you not using Access, not using Access 2016, and if you ARE using an mdb format, then you can continue to use the ADODB object. You not need Access 2016 installed.

    However, that web server will require that the database engine JET (for mdb files), or ACE (for accDB files) is installed correctly on your server.

    MORE important however the database engine is has to match the bit size of your WEB server (I stress here the bit size of IIS). If your web server is running as x64 bits, then there is NOT an x64 bit version of JET available. In this case you have to install an x64 bit version of ACE. ACE is able to open the mdb format, but I believe it has to be Access 2000-2003 format – Access 97 format is too old.

    If the database really is from access 97 format (20 years old!!!), then you likely best convert the mdb to an Accdb. You may well have to do this anyway if your web server is running as x64 bits.

    An alternative would be to run an x32 bit version of your web server, and then you could continue to use access 97.

    If you need/want an x64 bit version of ACE, then you can try this download:

    https://www.microsoft.com/en-us/download/details.aspx?id=10910

    I suggest 2010, since it has a better chance of using + opening the mdb file then 2016 does.

    Keep in mind to choose the x64 bit Access/runtime if you web server is x64, and x86 version if you running x32 bit web server. My spider sense best guess is your web server is x64 bits if it is a recent install.

    However, if the SAME web server was working with the mdb file, and you NOT changed anything else, then logic suggests you are using x32 bit version of IIS.

    While Access as a client can connect to say SQL server x64 or x32 (it don’t matter bit size), your web server code running on the server MUST match the bit size of Access/Database engine for your code to work. And that in turn means that the bit size of the Access database engine (JET or ACE) MUST also match the bit size of the IIS server.

    Regards,
    Albert D. Kallal (Access MVP, 2003-2017)
    Edmonton, Alberta Canada


    Thursday, November 2, 2017 1:24 AM
  • Hi Diego,

    Has your issue been resolved?

    If it has, I would suggest you mark the helpful reply as answer, If not, it would be helpful if you could share us what you have tried and what error you got?

    Regards,

    Tony


    Help each other

    Wednesday, November 8, 2017 7:52 AM