jack niekerk
asked on
RESHOWING ADOGRID WITHOUT CLOSING DATARECORD/FIEL
I have a large (30000 records) file, opening /reading in adogrid takes 2 to 3 minutes, can live with that, but, see source what I have to do after insert/update/delete,
if I don't close the file only file gets (unvisible) uopdated, not the adogrid, thus still
showing the old data
So what would be the way to update both without closing????
Private Sub cmdSave_Click()
'========================= ===
Dim book As Long
Customgrid.Col = 0
DebNum = Trim(txtCustomerId) ' is key for record on form
book = Customgrid.Bookmark
If book > 100 Then book = book - 100 Else book = 0 ' to make sure we
rsCustomers.MoveFirst ' are not passing gridposition
rsCustomers.Move book
'=====
readFile:
'=====
rsCustomers.MoveNext
If rsCustomers.EOF Or rsCustomers.BOF Then Exit Sub
If rsCustomers.Fields(0) = DebNum Then
rsCustomers.Fields(3) = Left$(txtName1 + Space$(40), 40)
rsCustomers.Fields(4) = Left$(txtStreet1 + Space$(40), 40)
rsCustomers.Fields(5) = Left$(txtCity1 + Space$(30), 30)
rsCustomers.Update
rsCustomers.Save
Customgrid.Refresh ' will do nothing see below remm
rsCustomers.Close ' if these 5 lines are remmed
Set rsCustomers = Nothing ' adogrid is not updated only database
rsCustomers.Source = "" ' BUT reloading
dbCustomersActive = 0 ' after update takes so long!!!
Call Form_Load
Else
GoTo readFile
End If
End Sub
if I don't close the file only file gets (unvisible) uopdated, not the adogrid, thus still
showing the old data
So what would be the way to update both without closing????
Private Sub cmdSave_Click()
'=========================
Dim book As Long
Customgrid.Col = 0
DebNum = Trim(txtCustomerId) ' is key for record on form
book = Customgrid.Bookmark
If book > 100 Then book = book - 100 Else book = 0 ' to make sure we
rsCustomers.MoveFirst ' are not passing gridposition
rsCustomers.Move book
'=====
readFile:
'=====
rsCustomers.MoveNext
If rsCustomers.EOF Or rsCustomers.BOF Then Exit Sub
If rsCustomers.Fields(0) = DebNum Then
rsCustomers.Fields(3) = Left$(txtName1 + Space$(40), 40)
rsCustomers.Fields(4) = Left$(txtStreet1 + Space$(40), 40)
rsCustomers.Fields(5) = Left$(txtCity1 + Space$(30), 30)
rsCustomers.Update
rsCustomers.Save
Customgrid.Refresh ' will do nothing see below remm
rsCustomers.Close ' if these 5 lines are remmed
Set rsCustomers = Nothing ' adogrid is not updated only database
rsCustomers.Source = "" ' BUT reloading
dbCustomersActive = 0 ' after update takes so long!!!
Call Form_Load
Else
GoTo readFile
End If
End Sub
ASKER
I'm using VB6,
could you please give a (small) sample how syntax would look like?
Thanks Jack
could you please give a (small) sample how syntax would look like?
Thanks Jack
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I forgot about ADO, jumped to active X. That will work, just some more work.
Thanks anyway
Thanks anyway
Dont forget to call the refresh method of the ado grid.