Results 1 to 38 of 38

Thread: Error handling or missing dependency file?

Hybrid View

  1. #1
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: Error handling or missing dependency file?

    frayne,

    What does your connection string look like?

  2. #2

    Thread Starter
    Member
    Join Date
    Mar 2003
    Posts
    48

    Re: Error handling or missing dependency file?

    Dim sSQL As String
    Dim oConn As ADODB.Connection
    Dim oRst As ADODB.Recordset
    Dim sResults As String

    ' The SQL statment to retrieve the desired record(s)
    sSQL = "SELECT Sixtieths FROM Distances WHERE Name = '" & member.text & _
    "' AND Racepoint = '" & racepoint.text & "'"

    ' Allocate memory for our connection object and use a connection string to open the database


    Set oConn = New ADODB.Connection
    oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Persist Security Info=False;" & "Data Source =" & App.Path & "\distances.mdb"
    ' Allocate memory for the recordset
    Set oRst = New ADODB.Recordset
    With oRst
    ' Open the recordset using our SQL string and existing connection object
    .Open sSQL, oConn

    ' Loop through the results (in case there's more than one) until EOF (End Of File)
    Do Until .EOF
    ' Append the results to our results string
    sResults = sResults & .Fields(0).Value & vbNewLine
    ' Move to the next record
    .MoveNext
    Loop

    ' Close the recordset
    .Close
    End With
    ' Free memory
    Set oRst = Nothing

    ' Close the connection
    oConn.Close
    ' Free memory
    Set oConn = Nothing

    ' Display results to the user
    'MsgBox "The " & .racepoint.Text & "(s) from " & member.Text & " is/are:" & vbNewLine & sResults
    sixtieths.text = sResults

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