Results 1 to 4 of 4
  1. #1
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178

    Thumbs down Unanswered: Clsing a Form With VBA

    Grrr!

    I call a separate CloseForm() subroutine, where I try to close a previous
    form, from the current form's OnOpen event. I keep getting run-time error
    2585: "This action can't be carried out while processing a form or report
    event."

    How the heck else am I supposed to close the thing!? I tried calling it from
    the previous form's Close() event, but got the same error.

    My code is simple: DoCmd.Close acForm, "FormName"

    Thanks,

    Sam

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    In your previous form, the following should work:

    DoCmd.Open acForm, "CurrentForm"
    DoCmd.Close acForm, "PreviousForm"
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    Thanks Teddy,

    I couldn't get that to work. However, when I added a command button to close the form - which I did before unsuccessfully - it worked, but only after I removed the form name: DoCmd.Close

    Sam

  4. #4
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    Thanks Teddy,

    I couldn't get that to work. However, when I added a command button to close the form - which I did before unsuccessfully - it worked, but only after I removed the form name: DoCmd.Close

    Sam

Posting Permissions

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