Results 1 to 3 of 3

Thread: Urgently need help with this?? Isn't anyone who can help me??

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2000
    Location
    Posts
    52

    Angry

    Hello All,

    when I declare a dim on a form in the general area is it default private to the form public to all forms?

    when I unload the form, will these dims disappear?

    I'm wondering because I created some ADO.recordsets and when I close the form (click on the x)and reopen the form I get an error stating that the recordsets are still open.

    I have since put statements to close the ado.recordsets in the form unload but what the hell? How can they be open if I close the form anyways? cause when I reopen the form it has to redeclare the variables doesn't it? or does form1.show only unhides it?

    what there like no garbage collection?


    Thanks !


    Marci Sarwan (marci_sarwan@yahoo.com)
    Marci Sarwan

  2. #2
    Fanatic Member
    Join Date
    Oct 2000
    Location
    London
    Posts
    1,008
    By default, declarations at a general level are Public. The objects you declare should be destroyed when the form is destroyed, however it depends what and when you are doing. You may not be destroying the form properly. It is always best to close the recordsets explicitly. Garbage collection in VB is not fool proof.

    Code snippets might help.

    Cheers,

    Paul
    Not nearly so tired now...

    Haven't been around much so be gentle...

  3. #3
    Lively Member
    Join Date
    Oct 2000
    Location
    Houston, Texas - U.S.A.
    Posts
    84

    Post

    Variables declared as Dim in the General Declarations are Public, by default, to any procedures in that form but are not public outside of that form. e.g. modules, class modules, etc.

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