Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2021
    Posts
    7

    Forms opened as acDialog continue to show code as "[runnning]" and show odd behavior

    A couple of weeks ago, I set most of my forms to open as acDialog as preparation for a rollout. I started getting odd behavior on my forms and discovered that it was related to the forms being opened as acDialog.

    A couple of examples of the odd behaviour:
    1. The buttons and hyperlinks on the active form work only intermittently. (They should run code to open a form or report)
    2. When I open a VBA code window the text is locked and I can't change anything.

    I found that if I have the VBA window open when I call the form as acDialog, it says [running] at the top of the window. [running] does not go away until I manually press the Reset button in VBA. I tried stepping through the code and once I got past the OpenForm ... , acDialog call, there was no more code to step through, yet it continues to say [running]. When I remove acDialog from the call the odd behavior goes away and it does not say [running] in the VBA window.

    Another related question - Calling forms with acDialog makes development and debugging slower and more cumbersome for me. How do the pros do this to both simplify the development process and also make it an easier transition when it is time for a roll out?



    FYI: I apologize if this is a duplicate. I created a post not long ago but it looks as though our terrible internet connectivity may have disintegrated it. I waited a bit, then searched and do not see it, so decided to try again.

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Dialog forms suspend all code execution in the calling procedure. Can't comment on your first point without knowing what you deem to be the active form. If you mean the one that called the dialog form, then it is not active any more. If you mean the called form any code behind it should run as long as it doesn't call another dialog. The vbe behaviour is normal for what you describe. If you're testing, why can't you just deal with the dialog like everyone else will have to? If you could test the db in a way that users will never be able to then you're not really replicating normal user actions so that will be misleading. Not sure what you want to do when a dialog is open, but if it's related to another app then minimizing Access or having a second monitor might help.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    Join Date
    Jan 2021
    Posts
    7
    I would want to do final testing using the environment that the userwould see. My question about turning acDialog off is referring to earlier development stage testing. i don't want to have to change all of my calls before I release it. I am wondering if the easiest way to do this is to use If... then statements that would make the calls based on whether or not my development flag is set. How do the pros do this?

    I was concerned that the VBA window was showing something was running, when there did not appear to be code running. Based on what you are saying that seems to be the result of the code calling the form as acDialog. It makes sense now that it says [running] because it is waiting for the dialog form to close before it moves on through any other code that follows the OpenForm call.

    Thanks for the info.


  4. #4
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    Where I have lots of these, I have a table that lists the forms in the database, and a flag that indicates if it is Modal or not.
    I have a MakeProd (True/False) routine that loops through the forms in the table in design mode and changes them from Modal / Popup to Normal and vice versa.

    it's not perfect, but it certainly helps.

    It also hides/unhides various tables and unlinks / relinks some tables that I only connect to in code when required.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  5. #5
    Join Date
    Jan 2021
    Posts
    7
    Thanks for the tip. I have just started doing a lot more automating of the development process, so this is something I will consider as I determine the best way to deal with switching acDialog between development and production.
    Thanks again!

    Quote Originally Posted by Minty View Post
    Where I have lots of these, I have a table that lists the forms in the database, and a flag that indicates if it is Modal or not.
    I have a MakeProd (True/False) routine that loops through the forms in the table in design mode and changes them from Modal / Popup to Normal and vice versa.

    it's not perfect, but it certainly helps.

    It also hides/unhides various tables and unlinks / relinks some tables that I only connect to in code when required.

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

Similar Threads

  1. Replies: 2
    Last Post: 12-08-2019, 03:05 PM
  2. Replies: 2
    Last Post: 01-09-2019, 05:25 AM
  3. Replies: 1
    Last Post: 01-05-2013, 10:46 PM
  4. Replies: 2
    Last Post: 06-26-2012, 12:53 AM
  5. Replies: 3
    Last Post: 07-23-2011, 09:12 AM

Tags for this Thread

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