Results 1 to 5 of 5

Thread: OpenRecordSet question

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2001
    Location
    CT
    Posts
    124

    Cool OpenRecordSet question

    Say in my Access database I have 5 tables.
    Now would I have to use a separete instance for each table
    like

    Set rstInfo = .OpenRecordset("Info")
    Set rstCustomer = .OpenRecordset("Customer")
    Set rstEmployee = .OpenRecordset("Employee")

    Or could I put them all into once instance

    Set rstInfo = .OpenRecordset("Customer" & "Employee" & "Info")

    Or something like that, as I'm not sure how the 2nd way would work if it's possible.
    Vini, Vidi, Vici!
    -----------------
    say this 5 times fast
    "I am not a pheasant plucker, I'm a pheasant plucker's son. I'm only plucking pheasants, till the pheasant plucker comes."

  2. #2
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205

    Exclamation Egads!

    Don't!
    Use ADO/SQL.

    With ADO, you can just have one table open at a time, or many in separate recordsets, or whatever you want.

    If you refuse, then you need a new RecordSet for each table. Trust me, use ADO.
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  3. #3
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367
    You can use straight SQL to open mutiple tables:

    Code:
    dim rs as new adodb.recordset
    dimr strSQL as string
    strSQL = "SELECT * from Table1,table2 where table1.id=table2.p_ID"
    
    rs.open strsql,objConn,adOpenForwardOnly, adLockReadOnly

  4. #4
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    You may want to use some JOINS in there too...
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  5. #5
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367
    Yeah, i guess it depends on the DBMS you are using. The JOIN keyword is not really necessary. It just makes it look nicer. If I remember correctly Oracle does not even support the join clause.

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