delete a record from a Database
Forums
Hi,
I would like to add or remove records from an IDEA Database. That Data is used for Comparison and so it's OK to edit it. My Comments is in German but the Code works a bit. I ask the user to supply a Numer (NR_V) and then "delete" that record. Actually it is not deleted but it is "cleared". The line is empty then. I close an re-open the database to invoke a GUI update, then I extract the with NR_V >= 1 th get rid of the one cleared line.
I have 2 Problems:
a) My script only works one time. Maybe I need to re-index??? How can I do that?
b) is there anyway which is shorter/nicer to remove a record from a database?
Thanks
Karen
' Datensatzgruppe aus der Datei ermitteln.Set rs = db.RecordSet' Kriterium für RecordSet definieren. Hier wird festgelegt welcher Datensatz gelöscht wirdrs.Criteria = "NR_V =" & ResultLöschen
' Ersten Datensatz aus der Datensatzgruppe ermitteln.rs.ToFirstSet rec = rs.ActiveRecordrs.Next' Anzeigen, dass der Datensatz Daten enthält.'MsgBox "NR = " & rec.Value("NR_V")
' Inhalte des Datensatzes löschen.rec.ClearRecord' Datensatz speichern.rs.SaveRecord rec
I had a question on how to
I had a question on how to delete a range of records. Here is a short example where you enter the first record to delete and the last record and the script will remove all records within that range including the first and last record.
Sub Main
Dim iRecNo As Long
Dim iLastRecNo As Long
Dim db As database
Dim task As task
Dim dbName As String
iRecNo = InputBox("Please enter the first record to delete")
iLastRecNo = InputBox("Please enter the last record to delete")
Set db = Client.CurrentDatabase
Set task = db.Extraction
task.IncludeAllFields
dbName = client.uniqueFilename("Test")
task.AddExtraction dbName, "", "@Recno() < " & iRecNo & " .OR. @Recno() > " & iLastRecNo
task.PerformTask 1, db.Count
Set task = Nothing
Set db = Nothing
Client.OpenDatabase (dbName)
client.RefreshFileExplorer
End Sub
Hi Brian,
Hi Brian,
Is there a way to delete a specific row throughout the file? For instance, one of the rows in my database is for "address". This row is part of a heading section that breaks up each employee data set. So "address" shows up every 20-30 rows in a 60k record database and I need to delete just that row.
Thanks!
Hi hartmt,
Hi hartmt,
Probably the easiest way to do this is through a direct extraction. Create a criteria that will extract all rows except for the "address" row. Hopefully there is something within these rows that will allow you to isolate them. If you can share the database I might be able to give you some suggestions for the criteria. Let me know if you need more help on this.
Brian
Removal of a record