Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    San Francisco, California, USA
    Posts
    358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Database won't close? (Access 97 SR2)

    I don't know what I did to my database.....

    I close all the forms, the container window (with all the objects) is still open, and I click on the close button at the top of the database. Shouldn't this completely close the database?

    What I get is the access frame open, but the container window is closed. The access frame won't close at all. The only way out of this situation is <ctrl><alt><delete> [End Task] on Access.

    I also have a button on the main form that has the code DoCmd.Quit. This does not close the Access frame either.

    Does anyone know what I did & how to correct it? It's making me looney.

    TIA!

    Cecilia <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Database won't close? (Access 97 SR2)

    This is usually caused by objects that were set in your code but not destroyed. Setting a recordset object, for example, and not closing it and setting it to nothing or setting a querydef object and not destroying it. Try scouring your code for those kinds of things first. If that fails you, post back. I seem to recall a couple of other reasons for this, including not using specific comparisons in statements like this:

    If Me!txtOK Then ...

    Instead of

    If Me!txtOk = True Then
    Charlotte

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    San Francisco, California, USA
    Posts
    358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Database won't close? (Access 97 SR2)

    Hi Charlotte,

    Well, I've been pretty consistent about destroying objects. I'm checking the If statements now, how in depth do I need to go?

    For instance, is
    If IsNull(Forms!frmData.cboDivision)
    okay, or do I need to change it to
    If IsNull(Forms!frmData.cboDivision)=True
    and similarly
    If IsMissing(strDivision)
    These are all over the help files.
    The other one I have is If rst.NoMatch, should this be If rst.NoMatch=True?

    TIA!

    Cecilia :-)

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Database won't close? (Access 97 SR2)

    I'm *very* consistent about it, and I've been bitten by this, so check just to be sure. Querydef objects are easy to overlook because the really should go out of scope when the code container they're in is closed. Unfortunately, the isn't always the case.

    You only need to use the "= True" when the control's value itself evaluates to a boolean. The other method is to wrap the control reference in parens, which forces it to be evaluated. For instance, if you have a checkbox on a form, you might expect it to return a boolean value and skip over the rest of the expression, but it's risky. It should be:

    If Me!chkMyCheckBox = True ...

    Or

    If (Me!chkMyCheckBox) Then ...

    not just

    If Me!chkMyCheckBox then ...

    Using functions like IsNull gives you a boolean value because that's what they return.
    Charlotte

Posting Permissions

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