Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 2nd, 2006, 02:57 PM
Authorized User
 
Join Date: Mar 2006
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default Automation error..maybe missing parameter?

Could you all look for a problem in this ADO? TIA

Public Sub PlainTextQuery()

    Dim rsData As ADODB.Recordset
    Dim szConnect As String
    Dim szSQL As String

    szConnect = "Provider=Microsoft.Jet.OLEDB.4.0; " & _
                "Data Source=C:\Test\Calls.mdb; "

    szSQL = "SELECT Date, Skillset, Calls " & _
            "FROM Calls " & _
            "ORDER BY Date"

    Set rsData = New ADODB.Recordset
    rsData.Open szSQL, szConnect, adOpenForwardOnly, adLockReadOnly, adCmdText

    If Not rsData.EOF Then
        Sheet1.Range("A2").CopyFromRecordset rsData
        rsData.Close
        With Sheet1.Range("A1:C1")
            .Value = Array("Date", "Skillset", "Calls")
            .Font.Bold = True
        End With
        Sheet1.UsedRange.EntireColumn.AutoFit
    Else
        MsgBox "Error: No Records Returned.", vbCritical
    End If

    If CBool(rsData.State And adStateOpen) Then rsData.Close
    Set rsData = Nothing

End Sub

Gives Run-time error '-2147217904(80040e10)

This is almost identical to one in the VBA books. Thanks.

 
Old March 3rd, 2006, 09:38 AM
Authorized User
 
Join Date: Mar 2006
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This is fixed...thx Bob






Similar Threads
Thread Thread Starter Forum Replies Last Post
Automation Error nagarajan123 Access 0 April 30th, 2008 09:22 AM
Missing Parameter Field Current Value vk18 Crystal Reports 2 December 26th, 2007 10:01 AM
Missing parameter in Jet OLEDB connection OldCoder ASP.NET 1.0 and 1.1 Professional 2 April 21st, 2006 11:29 PM
Automation error..maybe missing parameter? kalebson Access VBA 4 March 3rd, 2006 11:48 AM
error 7866 when using automation pilmart Access 0 August 29th, 2003 02:57 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.