Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Database Update

Status
Not open for further replies.

wlaflamme

Technical User
Aug 1, 2003
22
US
Hello
I am new to using databases and I am struggling with this problem. I am using a VB program to automate a measurement process where I read via a com port some measurements and I want to place them in an access database. I wrote the the code to add a new row with all the data but when I go to look at it in another windows form where I view the database nothing is updated. Below is the code for the btn to create the new data row and update the database. Any help would be much appreciated.

Public Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click

' Create a new row.
Dim newRegionRow As ISDMeasurementDataset.Inside_LengthRow

newRegionRow = Me.IsdMeasurementDataset1.Inside_Length.NewInside_LengthRow
'newRegionRow.AutoNumber = ""
newRegionRow._Date = date1
newRegionRow.Time = time1
newRegionRow.Style = myShoeData.Style
newRegionRow.Model = myShoeData.Model
newRegionRow.Gender = myShoeData.Gender
newRegionRow.Size = myShoeData.Length
newRegionRow.Width = myShoeData.Width
newRegionRow.Last = myShoeData.Last
newRegionRow.Measurement = myShoeData.ISL(1)
newRegionRow._Operator = myShoeData.ISL(1)
Try
Me.IsdMeasurementDataset1.Inside_Length.Rows.Add(newRegionRow)

' Save the new row to the database
Me.Validate()
Me.MeasurementBindingSource.EndEdit()
Me.IsdMeasurementDataset1.AcceptChanges()
Me.Inside_LengthTableAdapter1.Update(Me.IsdMeasurementDataset1.Inside_Length)

' Application.DoEvents()

Catch ex As Exception
MsgBox("Database Update failed")
End Try
End Sub
 
I figured it out. I need to perform the accept changes after the Update () setting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top