Click to See Complete Forum and Search --> : DBGrid doesnt show records after delete....
NN
Jul 15th, 2000, 12:51 PM
Can anyone tell me why the DBGrid control doesnt show the new records I add after I delete all the displayed records?
The records do get added but just not displayed.
Although refreshing the Data Control does bring back the
records I dont know where I can put the "Data1.refresh "
statement as I get errors.
I tried the Reposition event ,didnt work. I tried the
afterinsert event , definietly didnt work!
I dont want to have a button to refresh the Data control.
Can some one help me?
NN
Jul 18th, 2000, 08:12 PM
Thanks Psyrus
But where is "after adding a record" ?
adding records is automatically handled by the DBGrid and Data control. So I have to use an event but I cant put the refresh inside any of the DBGrids events as I get errors.
I cant put the refresh statement inside the reposition event as that results in somekind of recursion!
Thanks for answering!
Psyrus
Jul 19th, 2000, 01:36 PM
How about this:
Private Sub DataGrid1_AfterUpdate()
DataGrid1.Refresh
End Sub
Or am I thinking of the wrong control.
NN
Jul 25th, 2000, 09:01 PM
Sorry I didnt respond earlier, I have been rather busy...
Thanks again Psyrus!
But when I do the above I get an error which say something
like "Cannot execute method in current context" ( for the
refresh method). I assume it is not possible to call any method on the underline recordset of the data control linked to the Grid while I am inside any event belonging to
the Grid.
Then what's the solution? Beat's me.
Thanks a million for replying Psyrus!!!
JHausmann
Jul 26th, 2000, 08:38 PM
Post the code you're having problems with.
NN
Jul 30th, 2000, 01:44 AM
Well there really is no code at all.....
Just add a DBGrid to a form, then link it to a Data Control.
Thats all.
Try adding a few lines then delete all of them.
Try to add a record via the grid and Hey? It dissapears!
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.