Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel 2010 How to use the new database connectivity instead of ADO and Jet

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
How to use the new database connectivity instead of ADO and Jet

I understand there is something newer than ADO and Jet?
I'm using Office 2010.

any ideas or suggestions welcome.
Or is ADO still Ok to use? I use it now without problems and have for a LONG LONG time now.

here is an example of Access and Excel
Code:
Excel
    Dim cn As ADODB.Connection
    Dim rs As ADODB.Recordset
    Set cn = New ADODB.Connection
    Set rs = New ADODB.Recordset
    FileName = Application.ActiveWorkbook.Fullname
    With cn
        .Provider = "Microsoft.Jet.OLEDB.4.0"
        .ConnectionString = "Data Source=" & FileName & ";" & _
        "Extended Properties=Excel 8.0;"
        .CursorLocation = adUseClient
        .Open
    End With
    SQLStringReport = "Select fieldname from table where fieldname = xxx;"
    rsReport.Open SQLStringReport, cn
    TotalRecs = rsReport.RecordCount
    With rsReport
        Do Until .EOF
        ' do some precessing
        rsReport.movenext
       loop
    End with

DougP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top