Results 1 to 4 of 4
  1. #1
    drharb is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2016
    Location
    Nome Alaska
    Posts
    4

    Closing a pop-up form?

    Hi All,
    I'm building a DB to do some quality assurance for medical reports. It started as something simple, but I'd like to make it a bit fancy if I can figure out how. So, there are a standard list of questions such as patient age, weight, condition.... Then there are questions that are conditional on whether the medical provider did a procedure. Such as starting an Intravenous line (IV). IF the provider started an IV, I would like to have a subform pop up and ask about where the IV was placed in the patient?, what size IV catheter was used?, how many attempts did it take to get it in place? I used the OpenForm command in a macro and it works fine. The form opens, the used can update the fields and then I wanted it to close the subform on the "LostFocus" or "OnExit" command on the last question. I also had it prompt the user for whether they want to save the data or not. We don't get that far, when the closing macro runs I get an error saying "A macro specified as the OnOpen, Onload, OnClose....property setting contains an invalid action for the property."


    Not being very adept at VBA I'd like to keep this simple if possible. If not, probably best not to have the pop up subforms. Any help out there?

    Thanks,
    Dave

  2. #2
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Many of us here don't use macros, but if you post a pic of what your macro steps look like (or write everything out) we're willing to take a shot at it.
    It sounds like yours is trying to do something (maybe save data) during the close event, which cannot happen. In vba, the Unload event fires before the Close event, so data is gone at that point where the Close event takes over. My guess would be that a macro is no different in that respect.

    IMO, best approach is usually to provide a Save/Close and Cancel buttons in your case. The lost focus event would NOT be the place I'd do anything like that. All the user has to do is give the last control the focus, then go back to a previous one to correct spelling - and the even will fire.
    Last edited by Micron; 11-14-2016 at 04:53 PM. Reason: spellin
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    drharb is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2016
    Location
    Nome Alaska
    Posts
    4
    Thanks Micron, I came to the same conclusion about an hour after I posted. So much easier to just add an "Save and Close" button after the last field update. User can just hit tab and enter and move on with life. Just FYI what I had done before was to put a "Save" in the macro before the attempt to close. Even so, when I specified to "prompt" the user to save it, it never got that far. I suspect that the CloseWindow command isn't really the right one for what I want to do, but it was the only command in the list. The CloseForm is available for an action for the "button" I installed, but not for the Macro Builder. Seems odd to me. Anyhow, THANKS, problem solved.

  4. #4
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    You could be missing macro list items in your view. There's an option to show all commands - I just don't understand why they made that an obscure choice.
    Glad you got it solved.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Trouble Closing Form with VBA
    By RAOtto01 in forum Forms
    Replies: 2
    Last Post: 12-11-2015, 02:37 PM
  2. Replies: 6
    Last Post: 01-06-2015, 12:37 PM
  3. closing form
    By joshynaresh in forum Access
    Replies: 6
    Last Post: 02-05-2014, 09:06 AM
  4. Replies: 5
    Last Post: 12-22-2011, 01:12 PM
  5. Closing a form through VBA
    By ghostmachine in forum Forms
    Replies: 4
    Last Post: 12-13-2010, 01:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums