VBA EXCEL DBASE SQL

From: Bill Wilkie (bwilkie_at_sbcglobal.net)
Date: 12/17/04

  • Next message: Ethan Hunt: "Err No. 80040e19(Object or Data matching......)"
    Date: Fri, 17 Dec 2004 14:13:27 -0800
    
    

    Using WinXPsp2 and OfficeXP Excel. Trying to get data from huge dbase
    dbf's.
    ----------------------------------------------------------------------------
    -----
    Rem Microsoft ActiveX Data Objects 2.8 in reference selected
    Sub test()
        Set MyConn = New ADODB.Connection
        MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
    Source=e:\databases;Extended Properties=dbase IV"
        MyConn.Open

    Rem do sql statement to load MyRecSet
    Rem Set MyRecSet = MyConn.Execute("SELECT restoid,dates,hours,menuid FROM
    payment")
    Rem Set MyRecSet = MyConn.Execute("SELECT restoid,dates,hours,menuid FROM
    payment WHERE payment.dates={20040827}")

    Rem copy recordset to ***
        ws.Range("A2").CopyFromRecordset MyRecSet

     MyConn.Close
    End Sub
    --------------------------------------------------
    Run with first SELECT with no WHERE command and I get all data.
    Run with second SELECT with WHERE command and get no data. No Errors just no
    data.
    The dbf field descripton of the dates field is "Date field formatted as
    CCYYMMDD (8 characters)"
    The CC is century.


  • Next message: Ethan Hunt: "Err No. 80040e19(Object or Data matching......)"