Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2004
    Location
    Sunshine Coast, Australia
    Posts
    52

    Unhappy Unanswered: error message when closing a form

    I have a function:

    private sub form_load()
    txtdate.setfocus
    end sub

    private sub txtDate_Gotfocus()
    txtdate.value=format(now(),"DD/MM/YYYY")
    docmd.printout
    call Form_Close
    end sub

    private sub form_close()
    docmd.close "frmDetails",acsaveno
    end sub

    the problem is when I call the form_close sub I get the following error:

    Run time error 2585
    Description: This action can't be carried out while processing a form or report event

    The problem occurs on the docmd.close command.

    Is there anyway to brute-force the closure of the form?

    Thanking you in advance

  2. #2
    Join Date
    Nov 2004
    Posts
    32
    Assuming that the "frmDetails" is the form that contains these procedures you are probably haveing the problem because by calling the form_close() procedure from the txtDate_Gotfocus() procedure the txtDate_Gotfocus() can't complete until the form_close() jprocedure completes. There for the form is trying to close while the txtDate_Gotfocus() procedure is still running.

    Try putting the procedures together as one in the txtDate_Gotfocus() procedure such as

    private sub txtDate_Gotfocus()
    txtdate.value=format(now(),"DD/MM/YYYY")
    docmd.printout
    docmd.close "frmDetails",acsaveno
    end sub

  3. #3
    Join Date
    Dec 2004
    Location
    Sunshine Coast, Australia
    Posts
    52

    Talking

    hi, thanks 4 ur help. I tried that but it didnt work. what i did was from the form that I used to open this one up, after everything was done it closed the form from there and not in the form i opened.

    I really luv it when you click help in access and no topic is displayed!

Posting Permissions

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