|
-
Jul 21st, 2003, 04:19 PM
#1
Thread Starter
Frenzied Member
Removing Records from a Database
I need to be able to cycle through all of the fields in a database while cycling through the values in a listbox to see if records exist in the database with a certain field, "identifier", that maches the value of the listbox in that cycle...
understand?
This is what i have so far... but it doesn't even look as if it even got started... the records are still in the dbase...
VB Code:
For i = 0 To lstImport.ListCount
For j = 1 To RS.RecordCount
If RS.Fields("identifier").Value = lstImport.List(i) Then
RS.Delete
RS.Update
End If
RS.MoveNext
Next j
Next i
i know that the looping code is good, i believe my problem is in the location of the Delete, Update, and MoveNext commands...
thank you
squirrelly1
Now happily married and still crankin' away at the keyboard.  Life is grand for a coder, no?
-
Jul 21st, 2003, 10:30 PM
#2
-= B u g S l a y e r =-
I think you should build a sql statement and then execute that.
Makes it cleaner and leaves the job to the db.
VB Code:
Dim SQL As String
Dim db As Database
Set db = opendatabase("yadidasdifoafj some db.mdb")
For i = 0 To lstImport.ListCount
SQL = "DELETE * FROM TableNameHere WHERE FieldNameHere='" & lstImport.List(i) & "'"
db.Execute
Next i
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|