Results 1 to 6 of 6
  1. #1
    Star Lounger
    Join Date
    Jan 2001
    Location
    Bethel, CT, USA
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Close Form Macro

    Its the details that get to me. <img src=/S/headthrob.gif border=0 alt=headthrob width=15 height=15>

    I have 40 forms. Each one opens from a button on the switchboard. Each form has a macro in the OnOpen event to make the switchboard invisible and another in the OnClose event to make the switchboard visible again. Everything works nice and flips back and forth like I wanted it to. Except when you close or exit Access while a form is open, then I get a message "The object you referenced in the Visual Basic procedure as an OLE object isn't an OLE object." As far as I can tell, this is coming from the macro trying to make the switchboard visible when it has already been closed by Access.

    What I can't seem to figure out is how to stop the macro if the switchboard is closed. Or, put some code behind the switchboard to prevent it from closing until the macro is finished. Alternatives that I didn't want to use are to disable the application exit except when the switchboard is open (user awkward), or put code behind each of the 40 forms.

    Any suggestions?

  2. #2
    Lounger
    Join Date
    Apr 2001
    Location
    Lakeland, Florida 33805-9595
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Close Form Macro

    I put a Close Form button on each form to return to Switchboard. Use the Button Wizard to make. (Form,Close Form) and put it on the same place on each form so users get used to the location. I make mine with Red text in Bold.
    On some machines you run out of memory if forms are left open.

  3. #3
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Youngstown, Ohio, USA
    Posts
    705
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Close Form Macro

    Have you considered actually closing your switchboard when one of its buttons is clicked, and then having your other forms re-open the switchboard when they are closed?

  4. #4
    Star Lounger
    Join Date
    Jan 2001
    Location
    Bethel, CT, USA
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Close Form Macro

    Boy do I feel foolish! <img src=/S/blush.gif border=0 alt=blush width=15 height=15>
    As grampa used to say, "Just hit the boy between the eyes with a two-by-four. That'll knock some sense into him."
    <img src=/S/smash.gif border=0 alt=smash width=30 height=26>
    <img src=/S/brainwash.gif border=0 alt=brainwash width=15 height=15>
    I chose to change visibility rather than close and open the switchboard with all its controls because I thought it would improve the transition speed.
    But now that I've done as you suggested I can't see the difference.
    Thanks for putting me back on the straight and narrow.
    P.S. Is there a difference I should care about? Like running on a slower machine?

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

    Re: Close Form Macro

    As a rule, forms with a lot of data behind them or forms that have to execute a query when they activate are good candidates for leaving open. Switchboards and other unbound forms don't have the recordset overhead, so it doesn't really hurt to close them.
    Charlotte

  6. #6
    Star Lounger
    Join Date
    Jan 2001
    Location
    Bethel, CT, USA
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Close Form Macro

    Thank you for your input. It is greatly appreciated.

Posting Permissions

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