Why this variable is becoming blank or null?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • samvb
    New Member
    • Oct 2006
    • 228

    Why this variable is becoming blank or null?

    I just finished building a functional database program and was about to submit it. The startup is sub_main() which connects to access database, as follows

    Code:
    'public variable
    public db as new adodb.connection
    
    sub main()
    'create connection
    
    end sub
    The connection is created and works fine. At first my application was using MDI FORM based where everything was in the MDI Form thru buttons. But now, they wanted a "Switch Board Form" so sub_main() opens frmswitch which got 10 buttons for each form.

    Now, the problem is when a button is clicked to open a form and that opened form have to get something from the database as it opens up [at form_load], like this:

    Code:
    dim rs1 as new adodb.recordset
    rs1.open sql,db,adopenkeyset,adlockoptimistic
    it generates error because connectionstrin g of db variable becomes null. I don't know when the error emerges because sometimes it works fine, sometimes it doesn't.

    I never had the problem in the previous application, just when the whole Switch Board application request came in.

    Why would db.connectionst ring became null or blank?

    [/code]
Working...