Click to See Complete Forum and Search --> : Adding New Records in a DBGrid


daneb
May 24th, 2001, 08:10 PM
Hi.

I have a DBGrid populated with an Access 97 table data through a Data Control. The displayed data sometimes takes up to a hundreds or even thousand of records. The requirement is to be able to add new records, so I changed the AllowAddNew property to True. If I want to add a new record, I have to scroll down below. The problem is, it takes a while to reach the last record in the grid. Sometimes, the grid is not even scrolled since the record pointer remains in its position.

What I'm thinking of is to put a command button and when I press this button, the grid will automatically scroll down and put the cursor in the first cell of the new row. This will definitely save user's time. Is this possible? Thanks for the info!

O.K
May 25th, 2001, 02:01 AM
Hi,
you can use data1.recordset.addnew for adding new data. Normally the grid scrolls automatically (and you don't have to load all pages of the table).

O.K

daneb
May 25th, 2001, 02:59 AM
Thanks for the reply. All records must be loaded in the grid because the user will also be allowed to edit some cell values. I tried putting the code you suggested in a command button and executed it, but the grid didn't scroll down automatically and didn't put the focus on the first cell of the new row. This happened despite setting the AllowAddNew property of the grid to True. Do you have anymore ideas?