vbams-accessrefresh

How to refresh an access form


I am building an MS Access application in which all the forms are modal. However, after data change in a form, I want to refresh the parent form of this form with newer data. Is there any way to do it. To elaborate further :

Consider there are two forms, Form A and Form B. Both are modal form. From Form A, I initiate Form B, and now Form B has the user attention. But at the close of form B, I want to refresh the Form A. Is there a way to do it?


Solution

  • No, it is like I want to run Form_Load of Form A,if it is possible

    -- Varun Mahajan

    The usual way to do this is to put the relevant code in a procedure that can be called by both forms. It is best put the code in a standard module, but you could have it on Form a:

    Form B:

    Sub RunFormALoad()
       Forms!FormA.ToDoOnLoad
    End Sub
    

    Form A:

    Public Sub Form_Load()
        ToDoOnLoad
    End Sub    
    
    Sub ToDoOnLoad()
        txtText = "Hi"
    End Sub