Results 1 to 5 of 5

Thread: Subs and recordsets

  1. #1

    Thread Starter
    Hyperactive Member Kagey's Avatar
    Join Date
    Sep 2000
    Location
    The Wilderness of New Brunswick
    Posts
    294

    Arrow

    Hello,

    I have a problem and i am sure there is a simple solution. When i create a connection and a recordset in the click event of a button, i can't access the recordset's or connections's properties outside of the sub. It just gives me the "object required" msg. I can manipulate them inside of the same sub, but that's it.

    Dont ask y i posted this in this forum, cause i dont know

    Thanks in advance!

    Kyle

    [Edited by Kagey on 01-02-2001 at 07:59 PM]

  2. #2
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    258
    Is your object Variable going out of scope ?


    []P
    Visual Basic 6 SP4 on win98se

    QUIT THE RAT RACE BECAUSE YOUR MESSING THE WORLD UP !!!!!

  3. #3

    Thread Starter
    Hyperactive Member Kagey's Avatar
    Join Date
    Sep 2000
    Location
    The Wilderness of New Brunswick
    Posts
    294
    apparently it is. i created it using
    Code:
    Dim conn as new adodb.connection
    Dim rst as new adodb.recordset
    when i do this, i can only access their properties inside of the same sub.

  4. #4

    Thread Starter
    Hyperactive Member Kagey's Avatar
    Join Date
    Sep 2000
    Location
    The Wilderness of New Brunswick
    Posts
    294
    Never mind, i figured it out. thanks for your help though. It helped me out (which is why it is called help).

    later

  5. #5

    Thread Starter
    Hyperactive Member Kagey's Avatar
    Join Date
    Sep 2000
    Location
    The Wilderness of New Brunswick
    Posts
    294
    in general declarations
    Code:
    Private WithEvents con As ADODB.Connection
    Private WithEvents rst As ADODB.Recordset
    then in the sub i put

    Code:
    Set con = New ADODB.Connection
    Set rst = New ADODB.Recordset
    is there a more efficent way of doing it?

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