Results 1 to 8 of 8

Thread: can I open two recordsets at the same time?

  1. #1

    Thread Starter
    Addicted Member GenocideOwl's Avatar
    Join Date
    Jul 2006
    Location
    Ohio
    Posts
    144

    Resolved can I open two recordsets at the same time?

    or do I need to close one, then open the other?
    Last edited by GenocideOwl; Jul 31st, 2006 at 12:51 PM.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: can I open two recordsets at the same time?

    Quote Originally Posted by GenocideOwl
    or do I need to close one, then open the other?
    Oh sure. You could open 50 recordsets at the same time, although I have no idea why you would.

    You do, however, need to give them different names.
    VB Code:
    1. Option Explicit
    2.  
    3. Private rsOwl As ADODB.Recordset
    4. Private rsHack As ADODB.Recordset

  3. #3
    Hyperactive Member
    Join Date
    Feb 2006
    Location
    Philippines
    Posts
    468

    Re: can I open two recordsets at the same time?

    you can also use multiple recordset but microsoft jet doesnt support them

  4. #4

    Thread Starter
    Addicted Member GenocideOwl's Avatar
    Join Date
    Jul 2006
    Location
    Ohio
    Posts
    144

    Re: can I open two recordsets at the same time?

    so, since I am using MSjet, I can't open two at once?

  5. #5
    Hyperactive Member
    Join Date
    Feb 2006
    Location
    Philippines
    Posts
    468

    Re: can I open two recordsets at the same time?

    you can declare two recordset like hack did but declaring 1 recordset and opening it with multiple queries is not supported by MSjet
    eg:
    rs.Open "SELECT * FROM table1 ;SELECT * FROM table2"

  6. #6

    Thread Starter
    Addicted Member GenocideOwl's Avatar
    Join Date
    Jul 2006
    Location
    Ohio
    Posts
    144

    Re: can I open two recordsets at the same time?

    so I couldn't do say

    VB Code:
    1. Set cn = New ADODB.Connection 'we've declared it as a ADODB connection lets set it.
    2. cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    3. "Data Source= " & App.Path & "\CRTInventory.mdb" 'this is the connection string explained in the notes section.
    4. cn.Open
    5. Set rs = New ADODB.Recordset 'as we did with the connection
    6. rs.Open bargeDB, cn, adOpenKeyset, adLockPessimistic, adCmdTable
    7. rs2.Open "CRTInventory", cn, adOpenKeyset, adLockPessimistic, adCmdTable

  7. #7
    Hyperactive Member
    Join Date
    Feb 2006
    Location
    Philippines
    Posts
    468

    Re: can I open two recordsets at the same time?

    you can open recordset as many as you want using one connection
    dim rs as adodb.recordset
    dim rs2 as adodb.recordset
    Set rs = New ADODB.Recordset
    Set rs2 = New ADODB.Recordset
    rs.Open bargeDB, cn, adOpenKeyset, adLockPessimistic, adCmdTable
    rs2.Open "CRTInventory", cn, adOpenKeyset, adLockPessimistic, adCmdTable

  8. #8

    Thread Starter
    Addicted Member GenocideOwl's Avatar
    Join Date
    Jul 2006
    Location
    Ohio
    Posts
    144

    Re: can I open two recordsets at the same time?

    ok, thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width