Quote:
> I would like to add a quick bit of code to my Visual Basic app, to delete
> all records from a table where a criteria is met. For example, I would like
> to delete all records from table comments, where custid=123.
Access mdb? Easy to open with DAO, then execute your DELETE SQL:
Dim dbSuperior As Database, strSQL As String
Set dbSuperior = OpenDatabase("C:\SomeFolder\Your.mdb")
strSQL = "DELETE FROM comments WHERE custid = 123"
dbSuperior.Execute strSQL
dbSuperior.Close
Set dbSuperior = Nothing
Note that punctuation above assumes that field custid is a Number data
type. If field is Text data type, the value 123 must be surrounded by
single-qoutes:
...custid = '123'"
Hope that helps.
--
Jim in Cleveland
If you're writing to me, in my address
change "REAL_Address.see.below" to "worldnet.att.net"
"What's so funny 'bout peace, love & understanding?"
- Nick Lowe