I have a project to submit in a few hours' time. In order to explain what I need clearly, I will provide a very simple example. Suppose I have an application consisting of 3 forms-
The first has a textbox(txtName) and a button leading to the second form.
The second has another textbox(txtFamilyName) and a button both leading to the third form and sending the info to a row in MS Access.
The third only has a button coming back to form1 so that a new row can now be added to the Access file.
My own project, ofcourse, is much more complicated than this, but I am hoping this would keep things simple and clear...
Let's assume that I've established a connection between my application and the access file in all three forms... which is exactly what I have done in my own 7 form application (lol!). then in the loading event of form 1 I have typed the following code:
Dim pintrecords As Integer
Dim bndTemp As Binding
pintrecords = odbdaApplicants.Fill(DsApplicants1)
bndTemp = New Binding("text", DsApplicants1, "tblApplicants.fldName")
txtName.DataBindings.Add(bndTemp)
txtName.text=""
bndTemp = New Binding("text", DsApplicants1, "tblApplicants.fldname")
txtName.DataBindings.Add(bndTemp)
The reason why I cleared txtName.text was that it was showing info already in the access file and I wanted to enter info that would now go into a new record.
In the loading event of form 2, I have entered the same coding as above except that I've replaced txtName with txtFamilyName and fldName with fldFamilyName
In the coding for the button in form 2 I have entered the following:
Dim pdsInsertedRows As DataSet
Me.BindingContext(DsApplicants1, "tblApplicants").EndCurrentEdit()
pdsInsertedRows = DsApplicants1.GetChanges(DataRowState.Added)
If Not pdsInsertedRows Is Nothing Then
odbdaApplicants.Update(pdsInsertedRows)
End If
DsApplicants1.AcceptChanges()
Dim frmNewApplication As New Form3
Me.Hide()
frmNewApplication.Show()
In coding for the button in form3 I have entered the following:
Me.BindingContext(DsApplicants1, "tblApplicants").AddNew()
Dim frmName As New Form1
Me.Hide()
frmName.Show()
I have no problem entering the info or browsing through the forms, but once I check the access file, it hasn't been updated ( a new row hasn't been added).... Can you please tell me where I'm wrong??