Routines between different formats in VB

Asked

Viewed 44 times

0

Good, I’m making a VBA application with 2 Forms. In Form1 I have a flexgrid that loads records from a database and in form 2 I have a textbox that introduces registration in the same database. What I want to do is to click the add button from form2 to the Form1 grid automatically update. How do I update since they are different formats?

ps: I cannot have buttons in Form1 to update, it has to be even automatically after clicking the add button of form2.

Thank you :)

1 answer

0


What you need would be something like:

//Form1
Public Sub Atualizar()
    MsgBox "Atualizado"
End Sub

Private Sub Command1_Click()

    Dim objForm2 As Form2

    Set objForm2 = New Form2

    Set objForm2.Formulario = Me

    objForm2.Show 1

    Set objForm2 = Nothing

End Sub

//Form2
Private m_objFormulario As Form1

Public Property Set Formulario(ByVal oValue As Form1)
    Set m_objFormulario = oValue
End Property

Private Sub Command1_Click()
    Call m_objFormulario.Atualizar
    Unload Me
End Sub

Browser other questions tagged

You are not signed in. Login or sign up in order to post.