Results 1 to 2 of 2
  1. #1
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664

    Recordset

    I know that I should have learned this long ago but it is never too late.



    What is exactly a recordset and when and why is it used. I know it is set of records literally translated, but so is a table
    so why not use that instead? It seems a abstract concept, but why use it and where to use it?

    Any help appreciated. Thanks in advance.

    Respectfully,

    Lou Reed

  2. #2
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    A recordset is just that - it is a set of records that are retrieved from "somewhere" (see below) into a recordset object, which can be manipulated as required.

    The source of the records in a recordset can be a table or a query - the query can be a saved query, or it can be expressed as an SQL Select statement. When the recordset is defined (opened), the selected records can be filtered or ordered as needed. A recordset can be (and often is) empty, i.e. contains no records, but that is perfectly normal, and is easily worked with.

    Where are recordsets used? Actually, you work with them all the time - you just dont realize it. When you open a form that is to display/edit data, the form creates (behind the scenes) a recordset that contains the data the form is to use. Users determine what is in the form's recordset by setting the Record Source property of the form, and by applying filters and sort orders to it.

    When you open a Select query, you are seeing the contents of a recordset.

    From a developer's perspective though, recordsets are used extensively in VBA programming. If you have a groups of records that you want to manipulate in some way (add, edit, delete, etc), and you are going to do that in VBA, you begin by getting retrieving all the data (records) you need into a recordset. Once you have that, you can step through the records one by one, move up or down, search, update, etc., etc.

    ... it is set of records literally translated, but so is a table so why not use that instead?
    The easiest answer is that table records cannot be manipulated directly in VBA - they have to be put in a recordset first. The same is true for select queries. (Note: table records can be manipulated using SQL, but SQL isn't the same as VBA).

    I know that is a lot to absorb, but if you are going to be using VBA frequently, you do have to know what recordsets are, and how you can use them. There are all kinds of websites and tutorials on how to create and use recordsets, so just enter "Access Recordset Tutorial" in to a web search, and you'll find a lot to get you started.

    Go for it!

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

Similar Threads

  1. Replies: 4
    Last Post: 01-22-2015, 09:57 AM
  2. Replies: 6
    Last Post: 12-03-2013, 11:14 PM
  3. How to Select second Recordset from first recordset
    By FrustratedAlso in forum Programming
    Replies: 28
    Last Post: 05-10-2012, 05:45 PM
  4. Replies: 2
    Last Post: 03-08-2012, 12:59 PM
  5. Replies: 1
    Last Post: 11-13-2009, 03:03 AM

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