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

Datagrid ADO Requery 1

Status
Not open for further replies.

Knutjo

Programmer
Jan 15, 2002
31
0
0
NO
Hi !

I have a problem updating a datagrid connected to a ADODC object and a Access 2000 database. When I am inserting av new record the first time everything is fine. The second time the application stops/hangs up. The same is happening when I am deleting records.

I'm doing av Requery in the AfterUpdate event of the DataGrid

Private Sub DataGrid_SelskapRetur_AfterUpdate()
Adodc_SelskapRetur.Recordset.Requery
End Sub

Someone got any idea of what is wrong ???
 

Why are you doing a Requery? Remove it! [/b][/i][/u][sub]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
....yes, I can remove it but then the records in the datagrid is presented in nonsorted order after inserting records. I want sort the records by a code in one of the columns.

Knutjo.
 

Then try the .Sort method of the ADO rs object, or the ADO Recordset Change complete event, first checking status if a record was added or not.

But, in any case, do not call this requery in the AfterUpdate event!

Normally you wouldn't do it that way. Add a button for the user to click on when the sort is to be applied again.

Look at the table view grid in ACCESS. This is may be considered an acceptable way. Try to conform to it. [/b][/i][/u][sub]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
....the "button"-solution is of course a way to do this, but if you want to have a automatic resort of records in the datagrid where would you placed the "requery"-method ?

(the sort property had no effect...)


Thanks (again) CCLINT

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top