Data Entry form problem

  • Thread starter Thread starter ajw
  • Start date Start date
A

ajw

I am a VB.NET newbie...
I have a data entry form with text boxes bound to a dataset. The data source
is an Access table with the primary key field being an autoincrement field.
Everything works fine except adding a new record. When I use the following
code, the dataset count is incremented but the form does not position to the
new row nor can I position to it.
BindingContext(dsTest, "tblTest").EndCurrentEdit()
BindingContext(dsTest, "tblTest").AddNew()
I have also tried to add a row using the following code, but it also does
not allow me to access the new row unless I update the database the the next
two lines of code. Then an empty record is created with the correct
autoincremented field.
rw = dsTest.Tables("tblTest").NewRow

dsLocation.Tables("tbllocation").Rows.Add(rw)
UpdateDatabase()
I have been fighting this problem for several weeks and can not figure it
out. Any help would be appreciated. Or is there another board where I should
be posting this?
Thanks
aj
 
Hi Ajw,

Can you try this (as sample you have to scroll of course)
BindingContext(dsTest, "tblTest").EndCurrentEdit()
The one above a little bit strange here that you place before the update of
your database.
(Has nothing to do with your problem)
BindingContext(dsTest, "tblTest").AddNew()
CType(BindingContext(ds.Tables("tblTest")), CurrencyManager).position +=1
This go one row further, back is of course -= 1

I hope this helps?

Cor
 
Back
Top