Using:
MS Access 2010
Visual Studio 2010 with Provider=Microsoft.ACE.OLEDB.12.0 Connection

I have 2 forms:
frmCustomers contains datagridview that launches
frmEdit used to edit record.

The issue I am having is my save button on frmEdit saves changes to the datagridview on frmCustomers but not to the database

frmCustomers:

Public Class frmCustomers

    Private Sub frmCustomers_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'AutoBillDataSet.Customer' table. You can move, or remove it, as needed.
        Me.CustomerTableAdapter.Fill(Me.AutoBillDataSet.Customer)

    End Sub

    Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.Click
        Me.CustomerTableAdapter.Fill(Me.AutoBillDataSet.Customer)
        Me.dgvCustomers.Refresh()
    End Sub

    Private Sub CustomerBindingSource_BindingComplete(ByVal sender As Object, ByVal e As BindingCompleteEventArgs) Handles CustomerBindingSource.BindingComplete
        If e.BindingCompleteContext = BindingCompleteContext.DataSourceUpdate AndAlso e.Exception Is Nothing Then
            e.Binding.BindingManagerBase.EndCurrentEdit()
        End If
    End Sub

    Private Sub dgvCustomers_CellDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvCustomers.CellDoubleClick
        Dim editForm As New frmEdit
        editForm.DataSource = Me.CustomerBindingSource(e.RowIndex)
        editForm.ShowDialog()
    End Sub

    Private Sub btnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEdit.Click
        Dim editForm As New frmEdit
        editForm.DataSource = Me.CustomerBindingSource.Current
        editForm.ShowDialog()
    End Sub

    Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
        Dim Dr As DataRow
        Dim dlgResult As DialogResult
        Dr = AutoBillDataSet.Customer.Rows.Item(dgvCustomers.CurrentRow.Index)
        dlgResult = MessageBox.Show("Are you sure you wish to DELETE this account?", "Confirm Deletion?", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
        If dlgResult = DialogResult.Yes Then
            Dr.Delete()
            Me.Validate()
            Me.CustomerBindingSource.EndEdit()
            Me.CustomerTableAdapter.Update(AutoBillDataSet.Customer)
            Me.AutoBillDataSet.AcceptChanges()
        End If
    End Sub

    Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
        Me.Close()
    End Sub

End Class

frmEdit:

Public Class frmEdit

    Public Property DataSource() As Object
        Get
            Return Me.CustomerBindingSource.DataSource
        End Get
        Set(ByVal value As Object)
            Me.CustomerBindingSource.DataSource = value
        End Set
    End Property

    Private Sub frmEdit_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'AutoBillDataSet.Customer' table. You can move, or remove it, as needed.
        Me.CustomerTableAdapter.Fill(Me.AutoBillDataSet.Customer)

    End Sub

    Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        
        Me.Validate()
        Me.CustomerBindingSource.EndEdit()
        Me.CustomerTableAdapter.Update(Me.AutoBillDataSet.Customer)
        Me.AutoBillDataSet.AcceptChanges()
    End Sub

    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        Me.Close()
    End Sub
End Class

Any thoughts or references are appreciated.
Thank you in advance.

Got to be something simple i am overlooking...

Me.Validate()
                Me.CustomerBindingSource.EndEdit()
                Me.CustomerTableAdapter.Update(Me.AutoBillDataSet.Customer)

should save it to the database. I only get it to save to the dataset though even passing it back to form 1 (frmCustomers)

any ideas why it would not be saving to the database?

Is it possible something to do with parent/child form and needing to cal the save from the parent as opposed to child???

It has been recommended to me to use a Activate.frmCustomer event to save data to database.

either I haven't had enough coffee yet or brain is muddled but msdn activate.form page is not making sense to me right now.

does anyone have a code snippet or reference that explains it.

Talking to myself on this forum :(

but alas I solved it

added to frmEdit before I closed the form from the btnSave:

frmCustomer.Activate()

and added this event to frmCustomer:

Private Sub frmCustomers_Activated(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Activated
        If AutoBillDataSet.HasChanges Then
            Me.Validate()
            Me.CustomerBindingSource.EndEdit()
            Me.CustomerTableAdapter.Update(AutoBillDataSet.Customer)
            Me.AutoBillDataSet.AcceptChanges()
        End If
    End Sub

works like a charm now.

This question has already been answered. Start a new discussion instead.