Hi Please can somebody explain what is wrong with this code, clearly I am not understanding an important issue. I am using XP Sp 2 and Visual Studio 2003 with access databases (office XP).
The form has OleDbConnection1, OleDbDataAdapter1, DsHouses4Sale2
and wizards set-up to Add, Change,Delete.
Clearly my update in code is being 'blocked' by the automatic stuff, how then do I update when using the controls OleDbConnection1, OleDbDataAdapter1, DsHouses4Sale2 on a form? PS in same situation delete is OK.
<code>
Dim cb As New OleDb.OleDbCommandBuilder(OleDbDataAdapter1)
'
' DsHouses4Sale2.Tables("Houses4Sale").Rows(rowcur). Item(3) = newdata
' works when no changes made to its text field on the form txtAddr1.Text
' if changes update not working
' even this DsHouses4Sale2.Tables("Houses4Sale").Rows(rowcur). Item(3) = "newdata"
'
' newdata = InputBox("Input New Value") ' works (no changes to text field)
' newdata = txtAddr1.Text ' no changes made
'
' update the database
'
MsgBox(newdata)
DsHouses4Sale2.Tables("Houses4Sale").Rows(rowcur). Item(3) = newdata
OleDbDataAdapter1.Update(DsHouses4Sale2, "Houses4Sale") ' update access database
StatusBar1.Text = "Updated record details from form: rowcur=" + Str(rowcur) + newdata
'
' Now refresh dataset and data table
'
DsHouses4Sale2.Clear()
OleDbDataAdapter1.Fill(DsHouses4Sale2)
OleDbDataAdapter1.Fill(dt)
rowcur = 0
maxrows = (Me.BindingContext(DsHouses4Sale2, "Houses4Sale").Count - 1)
</code>
Pat