Page 2 of 2 FirstFirst 12
Results 16 to 21 of 21
  1. #16
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    644
    The problem you are having is when a sub calls DoCmd.OpenForm is that it will immediately return to executing it's code after it tells the other form to load unless you use the acDialog option for the window mode parameter:


    https://docs.microsoft.com/en-us/off...docmd.openform

    What's happening is it's loading your dialog form and then immediately executing the rest of the code before the user has a chance to select ok or cancel.

    See attached. I've implemented the acDialog option and changed the approach from hiding the window when the user clicks OK to saving a variable in TempVars that the calling sub can then check for results.
    https://www.microsoft.com/en-us/micr...2007-and-2010/

    I also removed the input mask from the beg and end date text boxes and added a formatting string instead, the input mask wasn't allowing me to enter any changes.

    FYI, The linked table manager couldn't find one of your tables in the back end.

    Finally, there is a problem in your events_load sub in the scateam accounting module that wouldn't compile, but I didn't have time to debug it.

    [EDIT]
    There are about half a dozen bugs that won't allow it to compile. Looks like mostly references to changed object names. I'd suggest adding 'Option Explicit' to the top of every code file to help catch these errors as you go
    https://www.excel-easy.com/vba/examp...-explicit.html
    Attached Files Attached Files

  2. #17
    WCStarks is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2016
    Posts
    303
    I didn't notice your response until now, as it was on a new page which I was not on.

    OK. Thank you very much. It is interesting that both dialogs worked fine initially, and the other dialog form still works without acDialog option!

    Concerning the table it can't find: I added a new Vendors table, which was not in the old back-end db. I need to create a new sanitized back-end, which I couldn't do earlier, as it wouldn't run, this morning.

    Perhaps those other errors in the old table are the result of changes made since then. I don't get compile errors in my current database. It is unfortunate that I couldn't have sent you the current back-end this morning.

    For some reason, I am no longer getting email notifications when a response is posted. I can't see how to turn it back on.

    The date/time input masks allowed me to enter all the digits without entering formatting characters, as 051320200700.

  3. #18
    WCStarks is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2016
    Posts
    303
    Where can I reference to learn about accessing form variables, as in:
    TempVars!Dialog_UD_Assign_Answer = False
    I don't understand this syntax. I guess _Answer is a form variable. When you said "global variable", did you mean _Answer? Where is TempVars declared?

  4. #19
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    644
    Honestly you better google 'ms access TempVars' before I get caught lying. I don't think they're *technically* global variables but they're essentially designed to be used that way. TempVars are Temporary Variables that persist through the session while the front end is open, you can set a TempVar and reference it from any form, module, or even query.

    Use globals sparingly. The whole name 'Dialog_UD_Assign_Answer' I just made up. I pick very descriptive names that won't likely conflict with anything else I might choose to use TempVars with.

  5. #20
    WCStarks is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2016
    Posts
    303
    So, I should understand that this statement, TempVars!Dialog_UD_Assign_Answer = False, assigns False to Dialog_UD_Assign_Answer, which has been assigned a "Global" status, by the TempVars object? How then, does this variable get modified by the Dialog Form? I don't see any connection to the Dialog Form in either statement. So, I don't see how it could have been modified by the Dialog Form. Totally confused.

  6. #21
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    644
    I put it in the click event of the enter button on the dialog form.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 15
    Last Post: 05-16-2018, 12:12 PM
  2. Replies: 1
    Last Post: 04-17-2018, 09:38 AM
  3. Replies: 7
    Last Post: 07-28-2015, 11:50 AM
  4. Replies: 3
    Last Post: 07-03-2013, 01:20 PM
  5. Delete child records with parent record
    By jpkeller55 in forum Access
    Replies: 8
    Last Post: 09-07-2010, 08:52 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 - Senior Forums