Vb 6 0 row cannot be located for updating eloydating
This is a collection of highly requested Visual Basic code that I put together back in 19.
Almost all of these samples will work on fine on Visual Basic 5.0 and for Microsoft Excel and Microsoft Access Programming (when done with VBA), however, I've only made sure that they work in VB6.
Trying to do an efficient delete of multiple records in an ADO recordset bound to a Data Grid control, and populated from an MS Access 2000 database. This will open and set everything'Dim con Obj As New ADODB. Data Source = rs Objdatagrid.refresh'''''''''''''''''''''''' 2. I'd like to sort on two other fields, Date Time and Document, which taken together form unique records, and then renumber the Index field.2) Then I'd like to do the equivalent of Access' "Compact and repair database" tool. Again thanks, Dan Well, for the compacting you can use JRO (Microsoft Jet And Replication Objects). So what I want to do is simply renumber the records after deleting the old ones. Trying to do the same thing with the data-bound control produces the same error on update that deleting a record did.
A row is deleted using the following code: With db Main. Here's what I've tried:'Reindex [Log] Dim dbcount As Integer con Obj1. Open str Query1, con Obj1, ad Open Static, ad Lock Read Only dbcount = rs Obj1. How do I sequentially write the numbers to the fields?
Anybody got a clue what's wrong here, or have another suggestion of how I could select multiple records based upon a list of doc numbers, then delete all records with the appropriate doc number?
Requery Loop End With Problem is, this requires a write and then reopen of the table every time and is horribly slow for a large number of records.
Thanks again, Dan You are opening the recordset as readonly.
Change your locktype to either Optimistic or Pessimistic, whatever is better for your solution, in the case of such a tight loop I don't believe it will matter.
Your help is *greatly* appreciated, and I now have a working program.
This will open and set everything'Dim con Obj As New ADODB. Data Source = rs Objdatagrid.refresh'''''''''''''''''''''''' 2. Next use code similar to mine below to create the objects.'' 1. Open "Provider=SQEDB; Server=S1; Database=my DB","sa"rs Obj. Open "Select * From tbl", con Obj, ad Open Static, ad Lock Read Only Set datagrid. So anyhow, I'm *not* EOF at the error point, it's for *every* record that gets deleted. Let's follow up; there are two things I should do to "clean house" before I close this adventure:1) I'd like to reindex the database now that its records have been cut substantially. has an index field named "Index" (I never said I was creative ) that is sequentially numbered. This works fine except that eventually, the Index number will grow too large without resetting. Update Next x Unfortunately, it appears that either you can't use this method to write to the recordset, or my syntax is wrong.
Next use code similar to mine below to create the objects.'' 1. Open "Provider=SQEDB; Server=S1; Database=my DB","sa"rs Obj. Open "Select * From tbl", con Obj, ad Open Static, ad Lock Read Only Set datagrid. Make sure you reference the latest version of 'Microsoft Active X Data Objects' in your project. Execute "Delete From tbl Where id In (list Of Ids)"rs Obj.requerydatagrid.refresh And that should do it. Also if this is helpful, please mark the post as so.-Matt True. This is exactly as described in MS Bulletin Q300586, BTW. I tried to give your post the star it deserved, but the system bombed on post, so I'll try to acknowledge you properly later. Neither the Date Time nor Document fields in my database are unique in and of themselves, and since Access requires a primary key for a table, I have created one by sequentially numbering the records and putting the record number in a field called "Index." When a new record is added, it's just given an Index value that's incremented 1 above the last record.
Put these two functions in your *file: ' This function determines if a given block of text is a "word".
' Below we say anything that starts with an alphabet character ' is a word.