Results 1 to 4 of 4

Thread: Super Urgent - ADO

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633

    Post

    I created an Excel spreadsheet that connects to an Access Database using ADO. The connection works fine on my machinge because I have ADO dlls. However, on my end user machine they don't.

    How do I install ADO connection on there machine. I tried copying my ADO dlls to there system but it did not work.

    I ALREADY WENT TO THE MICROSOFT SITE TO DOWNLOAD THE ADO. But I don't know which one to download.

    Please direct me in the right direction.

  2. #2
    Lively Member
    Join Date
    May 1999
    Posts
    89

    Post

    how did you set up the ado connection, i need to do something like this on my app.

    Also the latest ado is 2.1

  3. #3
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Correction, the latest ADO version is 2.5
    In order for the user to be up to date with ADO, you will need to install the most recent MDAC (Microsoft Data Access Components)

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633

    Post

    Scott!

    Here is the code to connect to Access Database. You do it similar like visual basic 6.0. Remember to go to the "REFERNCE" menu and check on Microsoft ActiveX Data Object 2.0.

    __________________________________________________________
    Option Explicit
    'OVERALL: This project will use one table and one query
    ' from the database "Ops_revw2000.mdb".
    ' TABLE NAME = "[dbo_Saveset_calc]"
    ' QUERY NAME = "[OR Status]"

    Public cn As ADODB.Connection
    Public rs As ADODB.Recordset

    Sub p_Fill_Listbox(strFormCaption As String, objMultiSelect, strSQL As String, strField As String)
    'PURPOSE: Uses ADO to retrieve an SQL Server recordset
    Set cn = CreateObject("ADODB.Connection")
    cn.ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)};" & _
    "DBQ=" & gstr_Database_Name & ";" & _
    "DefaultDir=" & gstr_Database_Location & ";" & _
    "UID=admin;PWD=;"
    cn.Open

    '_______________________________________________________________
    frmAccessDB.Caption = strFormCaption

    'PURPOSE: Refresh the listbox
    frmAccessDB.lstAccessDatabase.Clear
    frmAccessDB.lstAccessDatabase.MultiSelect = objMultiSelect

    Set rs = New Recordset
    With rs
    'PURPOSE: Query to get Ops Review Code
    .Open strSQL, cn, adOpenStatic, adLockOptimistic

    '____ Method 1 - Fastest ___________________________________________
    Dim int_Rec_Count As Integer
    Dim int_Counter As Integer
    .MoveLast
    int_Rec_Count = .RecordCount
    .MoveFirst

    For int_Counter = 1 To int_Rec_Count
    If Trim(.Fields(strField)) <> "" Then
    frmAccessDB.lstAccessDatabase.AddItem Trim(.Fields(strField))
    End If
    .MoveNext
    Next

    ''____ Method 2 - _________________________________________________
    ' Do Until .EOF
    ' 'PURPOSE: Populate the listbox with the
    ' ' new result from the recordset.
    ' ' Cannot be null!
    ' If Trim(.Fields(strField)) <> "" Then
    ' frmAccessDB.lstAccessDatabase.AddItem Trim(.Fields(strField))
    ' End If
    '
    ' 'PURPOSE: Move to the next record
    ' .MoveNext
    ' Loop
    ''__________________________________________________________________


    'PURPOSE: Total number of record
    frmAccessDB.lblRecordCount.Caption = "Total Records: " & .RecordCount

    'PURPOSE: Close the recordset
    .Close
    End With
    End Sub









    ________________________________________________________

    As for Serge!

    Thanks for the site but I found another site that actually download even faster and with out the question Microsoft make you answer. The only thing is I can remember where the site is now. But never the less I have the file.

    Thanks Serge.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width