Results 1 to 2 of 2
  1. #1
    WCStarks is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2016
    Posts
    314

    How to properly call a popup form within a function to get a value to store

    I have a Assets sub-form. When an Asset is acquired, I want to get the transaction entry number for that item from the accounting form. I call a function to open the accounting form in which I select the proper item. That form closes and the focus returns to the Asset form. However, the Asset form does not get updated. I need to click another button to update the asset record. I must not be calling up the popup form correctly so that the value gets updated in the target asset record upon closing the accounting form. Here is the function. The opened Team_Ledger_Sub-form puts the needed value in a small table for retrieval. The problem is that this function does not wait for the DoCmd to complete before it executes the the remaining lines in the function. Thus I need to execute the two lines following the DoCmd again in separate function. I am sure there must be a way to do this properly. I should have said that it doesn't get updated with the current value, but rather the old value from an earlier get call.

    Private Sub TIDSave_Click()


    Dim MyNum As Integer
    DoCmd.OpenForm "Team_Ledger Subform"
    MyNum = GetCurrData("CurrTID", "N")
    Comment = "TID: " & Format(MyNum, "000000")
    End Sub

  2. #2
    WCStarks is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2016
    Posts
    314
    Never mind. After further querying I found out how to get the function to pause just by adding WindowMode:=acDialog to the open command. I knew I was missing something.

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

Similar Threads

  1. Call a function in instances of a form
    By MidNite in forum Access
    Replies: 7
    Last Post: 04-26-2021, 11:23 AM
  2. Can I do this in a function call itself
    By greatwhite in forum Programming
    Replies: 5
    Last Post: 07-22-2019, 10:59 AM
  3. Popup not popup properly
    By perryc in forum Access
    Replies: 3
    Last Post: 04-19-2019, 05:47 AM
  4. Replies: 5
    Last Post: 11-17-2013, 04:20 PM
  5. Form command button to do something/call function
    By shubhamgandhi in forum Programming
    Replies: 2
    Last Post: 07-27-2011, 04:45 PM

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