Results 1 to 2 of 2

Got error with Values in Userform searching for data with ADOdb

Threaded View

  1. #1
    Registered User
    Join Date
    10-11-2017
    Location
    bulgaria
    MS-Off Ver
    365
    Posts
    1

    Question Got error with Values in Userform searching for data with ADOdb

    Got this Code here:
    My data is inside table called table3. Data in table go in through another userform for entry.
    I got 7 columns ,but want to search in just two of them . Sheet is called CaFR
    Private Sub CommandButton1_Click()
        Dim cn As Object, rs As Object, temp
            Me.ListBox1.Clear
        temp = Me.TextBox1.Value
        Set cn = CreateObject("ADODB.Connection")
        Set rs = CreateObject("ADODB.Recordset")
        With cn
            .Provider = "Microsoft.ACE.OLEDB.12.0"
            .Properties("Extended Properties") = "Excel 12.0;HDR=Yes;"
            .Open ThisWorkbook.FullName
        End With
        rs.Open "SELECT * FROM `CaFR$` WHERE CStr( cathegory) = '" & temp & "'", cn, 3
        If rs.RecordCount Then Me.ListBox1.Column = rs.GetRows
        Set cn = Nothing: Set rs = Nothing
    End Sub
    Last edited by tihomir; 10-20-2017 at 10:02 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Error 13 when searching for string matching range values
    By Ochimus in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-07-2016, 11:39 AM
  2. Error Searching across multiple sheets sum values
    By MrArlington in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-19-2016, 06:53 PM
  3. Replies: 1
    Last Post: 07-23-2015, 11:18 PM
  4. Searching for and returning values from a Listbox within a Userform
    By garden_gnome in forum Excel Programming / VBA / Macros
    Replies: 31
    Last Post: 10-20-2013, 12:08 PM
  5. [SOLVED] Userform searching data on another workbook
    By sachs_v5 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 01-31-2013, 04:30 AM
  6. Need help searching worksheet for userform textbox values
    By bsweet0us in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-16-2011, 10:57 AM
  7. searching data using a userform
    By stephen1000 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-05-2009, 10:58 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1