Results 1 to 5 of 5
  1. #1
    gg80 is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Posts
    328

    Set db set Set rst - what does it mean?

    I have designed several systems now, using a lot of VBA. When I find that I can't do something, the wonderful VIPs on this site either give me direct help or point me at a site that solves the problem. Several of the procedures that I have gotten in the past are preceded by "Set" statements like:.



    4 Set db = CurrentDb
    5 Set rst = db.OpenRecordset("tblDanceClass", _
    dbOpenDynaset)

    I have such statements all over my code, but don't know what they mean. A very uncomfortable feeling. I have googled , but haven't found anything that explains exactly what this means or why it is needed. I am already in my current data base, so why "set" it?. The set rst open statement doesn't seem to open the query or table in the parenthesis, so what does it do.? I know that it isn't practical to give me the lesson on this site, but can someone point me at a book or site that would explain it in simple terms?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    The Set command establishes an object in VBA, in this case a DAO recordset. Opening a recordset requires database qualifier. Don't have to use an object variable for the database. Could instead:

    Set rst = CurrentDb.OpenRecordSet("tblDanceClass", dbOpenDynaset)

    The code is opening the table VIRTUALLY, that is in memory, as a recordset object that code can manipulate.
    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
    gg80 is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Posts
    328
    I'm afraid that I got into VBA too far behind the normal starting point. I used macros a lot, then just moved sideways into VBA when I found some limitations. This, evidently, means that I really don't know the basic concepts. (I have no other programming experience other than some minor stuff in Basic a long time ago). I don't understand the terms "establishing an object" or "database qualifier" or even "DAO recordset" for that matter.

    Is there some book or site that you know of that can give me some of that basic concepts? I have a "Fundamentals" book by Callahan, but that is one place where the book is just completely worthless.

    Thanks for replying so quickly.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    This book looks interesting Access™ 2007 Programming by Example with VBA, XML, and ASP by Julitta Korol, Wordware Publishing, Inc.
    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.

  5. #5
    gg80 is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Posts
    328
    Thanks much-I will get it. As you can tell form my post, not understanding the basic underlying structure is very limiting.

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

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