Hi,
I have a macro that should open Access 2007 database in .accdb format.
Code works with .mdb format but with .accdb it doesn't. It returns
message that programme is unable to open database (I checked it with
several databases in .accdb format). Does anybody have a solution?

Sub Pokarz_form_lista_klientow()
    Dim rsKwerenda  As ADODB.Recordset
    Dim oConn As ADODB.Connection
    Dim sSciezkaBazy As String, sSql As String
    Dim rKlienci As Range


    Range("V_klienci").ClearContents
    sSciezkaBazy = Sheets("A_Ust").Cells(1, 2)
    Set oConn = New ADODB.Connection
    oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
sSciezkaBazy & ";"


      sSql = "SELECT Klient_Id, Status, Umowa, Region FROM Klienci
order by Status asc, Klient_Id asc"

    Set rsKwerenda = New ADODB.Recordset
    rsKwerenda.Open sSql, oConn
    Set OpenADODBRecordset = rsKwerenda


-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel

Reply via email to