Results 1 to 3 of 3
  1. #1
    kawi6rr is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    39

    Popup form refreshes main form?

    Hello, all help is greatly appreciated.
    I a few main forms and on each main form I have a button that pops up a new member form. When I close out of the new member pop up form I need it to refresh which ever main form had spawned it.

    At first I tried doing it on the Private Sub Form_Close() but it kept getting errors. I did some research and found that it can be done in a function which I’m showing below but get the error when calling the function.

    Here’s the code I’ve been trying but I’m getting a “byref argument type mismatch” error on the bolded "ADL_Main" below in the sub proc.

    Private Sub Form_Close()
    If CurrentProject.AllForms(ADL_Main).IsLoaded = True Then
    Call IsOpenForm(ADL_Main)


    End If

    If CurrentProject.AllForms(BES_Main).IsLoaded = True Then
    Call IsOpenForm(BES_Main)
    End If
    End Sub

    Public Function IsOpenForm(frmName As String) As Boolean
    If CurrentProject.AllForms(ADL_Main).IsLoaded = True Then
    IsOpenForm = True
    MsgBox "ADL_Main is open"
    'Forms![ADL_Main].Refresh
    End If
    If CurrentProject.AllForms(BES_Main).IsLoaded = True Then
    IsOpenForm = True
    MsgBox "BES_Main is open"
    'Forms![BES_Main].Refresh
    End If
    End Function

    Thanks!

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    My suggestion is to open these "PopUp" forms with the acDialog argument which will stop the code in the form that did the opening. The next line in the 1st form can then be Me.Requery which will not happen until the 2nd form is closed or made invisible.

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    FYI, anytime you want something to be triggered when returning to a Form, you can use its OnActivate event:

    Code:
    Private Sub Form_Activate()
     Me.Requery
    End Sub

    Having said that, in this case, I would probably use the same method Allan suggested!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Replies: 1
    Last Post: 02-29-2012, 09:38 AM
  2. copy from popup form to main form
    By alex_raju in forum Forms
    Replies: 2
    Last Post: 02-10-2012, 05:29 PM
  3. Updating Main form from a popup form
    By wdrspens in forum Forms
    Replies: 21
    Last Post: 06-13-2011, 01:34 AM
  4. Popup Form
    By NISMOJim in forum Forms
    Replies: 1
    Last Post: 10-23-2010, 09:16 AM
  5. Replies: 10
    Last Post: 09-27-2010, 08:06 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