Results 1 to 7 of 7
  1. #1
    Middlemarch is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2015
    Posts
    479

    Recordset question

    Is there any significant cost to Select * from as opposed to specifying the fields wanted?
    And can you filter a recordset more than once ? (Saves me trying if it can't be done)

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Recordset does have a Filter property.
    Would open another recordset using the first recordset. Review https://learn.microsoft.com/en-us/of...r-property-dao
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    To your first question, I'd say generally no. There is a cost, but unless there are a lot of unneeded fields and perhaps they contained large amounts of text or something, I doubt you'd notice a difference. Also the number of records being pulled. Basically it's question of how much data is being retrieved. A few fields in a few records, you won't see a difference. 50 extra memo fields in 5,000 records, maybe a different story.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    Middlemarch is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2015
    Posts
    479
    Thanks for the replies. Decided to not use "Select *" and have had some success with filtering,
    But have struck a snag... one of my fields is a calculated field Comm: [AAA] & Chr$(10) & [BBBB]
    It's index is 9 and printing r(9),name shows Comm as expected.

    However using Comm in the Filter command e.g. r.Filter = "[Comm] = " & Chr$(34) & a & Chr$(34) fails.
    Also r.Filter = "[AAA] & Chr$(10) & [BBBB] = " & Chr$(34) & a & Chr$(34) fails.

    So is it not possible to filter on a calculated field ?

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Yes, can filter on calculated field.

    Why are you using Chr$(10) - that is line feed and its presence could impact search results.

    Fails how - error message, wrong result, nothing happens?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    Middlemarch is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2015
    Posts
    479
    The fields are multi-line with vblf separators

    The error message was a bit vague - err 1006 error.description unknown
    It is worth sorting, or maybe I change to using 2 fields? But if it should work as you say... what would the filter line be ?
    I haven't had an issue with chr$(10) impacting searches so far.

  7. #7
    madpiet is offline Expert
    Windows 10 Office 365
    Join Date
    Feb 2023
    Posts
    566
    Not sure it matters a lot. I've always thought it's lazy to use SELECT *, instead of just including the columns you need. but then, I try to never use recordsets either, but sometimes you can't avoid it.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. recordset question
    By sanderson in forum Programming
    Replies: 16
    Last Post: 09-21-2015, 11:32 AM
  2. Form recordset question
    By RonL in forum Forms
    Replies: 8
    Last Post: 10-25-2014, 11:26 AM
  3. simple filtered recordset question
    By RonL in forum Access
    Replies: 3
    Last Post: 09-29-2014, 11:35 AM
  4. Replies: 6
    Last Post: 12-03-2013, 11:14 PM
  5. recordset .findfirst question
    By RonL in forum Programming
    Replies: 4
    Last Post: 06-22-2013, 01:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums