+ Reply to Thread
Results 1 to 2 of 2

Recordset search or DLookup

  1. #1
    Forum Contributor
    Join Date
    04-16-2020
    Location
    Alberta, Canada
    MS-Off Ver
    365
    Posts
    229

    Recordset search or DLookup

    What's better/faster??

    I imported a table from excel that I need to search by row for a variable, then search the heading names by another variable.

    I use a recordset search (rst!) based on the rst!Type and rst!Size, then do a fields name loop (rst.Fields(x)) for a thickness variable ..

    Please Login or Register  to view this content.

    or I could just arrange the data so I can just do a DLookup

    Please Login or Register  to view this content.

    The DLookup is a lot cleaner code wise, but the table for the recordset looping is 'easier on the eyes'.... but what runs faster? Does it even matter with a table that is 48 rows by 35 Columns?

    currently I have the recordset looping but figured i'd ask before I change my table.

  2. #2
    Registered User
    Join Date
    03-19-2022
    Location
    TBD
    MS-Off Ver
    O365
    Posts
    46

    Re: Recordset search or DLookup

    I've noticed that your table may be structured by using Thickness as column name, correct?
    Instead of looping through field names as below,

    Please Login or Register  to view this content.
    You can just use Cost = rst.Fields(CStr(Thk))

    In addition, we can assign a record set object with a SQL to have the return as a query instead of looping through the whole table.

    Please Login or Register  to view this content.

    To answer your question: Base on my experience, DLookup is more proper way to find a value in the database. However, it will see no difference on 48 rows of data.
    Last edited by chocolate_kitten; 03-19-2022 at 12:20 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Open another recordset within current recordset vba
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-02-2015, 04:32 AM
  2. DLookUp and Concatenation
    By sam8114 in forum Access Tables & Databases
    Replies: 1
    Last Post: 06-17-2015, 09:03 AM
  3. [SOLVED] DLookUp function
    By rmachbitz in forum Access Tables & Databases
    Replies: 4
    Last Post: 07-02-2013, 06:30 PM
  4. Combining IIF and DLOOKUP
    By snoproladd in forum Access Tables & Databases
    Replies: 5
    Last Post: 04-11-2012, 01:15 PM
  5. help with dlookup
    By enhydra in forum Access Programming / VBA / Macros
    Replies: 8
    Last Post: 06-07-2011, 05:35 PM
  6. Search within a recordset
    By akabraha in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-02-2007, 05:19 PM
  7. [SOLVED] Recordset's RowID as part of Recordset
    By Trip in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-22-2005, 06:55 PM

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