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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datagrid Navigation Problem with Addnew and Filter

Status
Not open for further replies.

AMT2

MIS
Aug 10, 2003
2
US
I am using a number of VB 6. Forms, each one is for a specific table (MS Access 2002). They all have command buttons for db processing (add/update/delete) which invoke appropriate db action via DataEnvironment.Recordset...., various text boxes bound to appropriate columns in the table, and a bound datagrid 6.0 control (SP5) used for navigational purposes (no updates allowed).

I recently added a filter for the recordset in form load section of form ("form2") to select only rows in "form2" table where "foreignkey2" equals a value set in "form1"; all tested and limits row retrieval fine. However, since then, the datagrid no longer behaves correctly when addnew is issued (by clicking on 'add' command button).

Previously, the datagrid would insert a (highlighted) blank row at the end of the grid as soon as addnew was invoked, and would fill in each column in this row as entries were made in individual fields on the form. Upon issuing a subsequent update, datagrid would still show focus on this last row. Now it does none of that. A blank row is no longer inserted at the end of the datagrid after addnew is invoked, and although add/update to db works fine, datagrid focus remains on same row that had it immediately prior to the add. Only when I manually scroll down to the end of the grid do I see the newly added row.

I have spun my wheels big time with bookmarks, also with the refresh command to no avail as they make no difference. Any ideas on what is causing this? Just some added info... I have some code in datagrid_selchange and rowcolchange to show current row in datagrid and it indicates -1 during the addnew process.

Any assistance would be MUCH appreciated. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top