Microsoft Access
  Home arrow Microsoft Access arrow Page 3 - Exploring Multiple Active Record Sets with...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MICROSOFT ACCESS

Exploring Multiple Active Record Sets with MS Access
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 6
    2006-05-31

    Table of Contents:
  • Exploring Multiple Active Record Sets with MS Access
  • Connecting to SQL 2005 using ADO
  • Executing SQL Queries on the Open Connection
  • Interleaving Data from Two Recordsets

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Exploring Multiple Active Record Sets with MS Access - Executing SQL Queries on the Open Connection


    (Page 3 of 4 )

    With the connection in hand you may get access to records from any of the tables as shown here. The syntax shown here comes from the drop-down help as shown here for rst4's Execute() method. Four connections, rst1, rst2, rst3, and rst4 are open at the same time.


    The rest of the code just displays the number of columns in the recordsets in four message boxes, the first of which is shown in the next picture.



    Properties of the opened recordsets

    The opened recordsets return the following values for some of the properties. The CursorType property returns a value of 0 which means it is Open forward only, and the LockType is 1 which means it is read-only. The CursorLocation property with a value of 2 means the queries are managed by the database server or the OleDB provider. Calling the sort method on the recordset returns a message that the provider does not provide any interface for sorting or filtering.


    Populating ListBoxes with the records

    All recordsets are opened at the same time as shown in the next picture for this snippet. Recordset's state property is 'open' for a value 1.

    MsgBox ("rst1's state is: " & rst1.State & vbCrLf _
    & "rst2's state is: " & rst2.State & vbCrLf _
    & "rst3's state is: " & rst3.State)
    

    Recordsets can be stuffed into a string which can be used as the RowSource of list boxes and combo boxes. However, the RowSourceType property should be set to Value List. For example, the following code populates a list box on the form as shown in the next picture. Similar code for the other recordsets can be used to populate the list boxes or combo boxes.

    
    Dim strRst1
    strRst1 = ""
    While Not rst1.EOF
    strRst1 = strRst1 & rst1.Fields.Item(0).Value & " | " &
    rst1.Fields.Item(1).Value & ";"
    rst1.MoveNext
    Wend
    Me.List2.RowSource = strRst1
    

    More Microsoft Access Articles
    More By Jayaram Krishnaswamy


       · Multiple Active Record Sets is new in SQL 2005 server. Although presented as a MS...
     

    MICROSOFT ACCESS ARTICLES

    - Linking SQL Express 2005 Tables to MS Access...
    - Working with Access Projects in Access 2007
    - Exploring Access 2007
    - Working with Stored Procedures in an MS Acce...
    - Creating and Using Action Queries
    - Creating Data Access Pages with Charts using...
    - Advanced Ideas using VBA
    - VBA Details
    - Updating Records in MS Access
    - Using ADO`s Record Object with URLs
    - Exporting XML from MS Access 2003
    - Importing XML into MS Access 2003
    - On Using Pass-through Queries in MS Access
    - Distributed Queries in MS Access
    - Configuring a Linked Microsoft Access Server...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
    Stay green...Green IT