Related Tables - Data Entry Form

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
This is my third attempt at getting a straight answer...
I have a Microsoft Access database that has one-to-many relationships. When I created the tables for the database, I did not enter any data into any records, as that will be done by the application user. My problems is when data is entered into the parent
and child tables, the parent table data is the only one that gets saved when clicking the save button on the binding navigator.
If I have the parent and child tables data entered the same way a user would prior to connecting the data source and add EndEdit() to the child table BindingSource in the BindingNavigator click event, everything works exactly the way I want it to.
This application is a data entry form, so it wouldnt make sense to have to have data entered in tables prior to adding the data source to my project. What is the best way to create a data entry form with one-to-many relationships? I GREATLY appreciate and
help!
<img src="http://social.microsoft.com/Forums/getfile/24306/" alt="


<pre>Public Class Form1



Private Sub TblClientBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TblClientBindingNavigatorSaveItem.Click

Me.Validate()

Me.TblClientBindingSource.EndEdit()

Me.SunStartBindingSource.EndEdit()

Me.TableAdapterManager.UpdateAll(Me.QHCdbDataSet)



End Sub



Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

TODO: This line of code loads data into the QHCdbDataSet.sunStart table. You can move, or remove it, as needed.

Me.SunStartTableAdapter.Fill(Me.QHCdbDataSet.sunStart)

TODO: This line of code loads data into the QHCdbDataSet.tblClient table. You can move, or remove it, as needed.

Me.TblClientTableAdapter.Fill(Me.QHCdbDataSet.tblClient)



End Sub

End Class[/code]



View the full article
 
Back
Top