Delete record with corupted memo field

G

Guest

I tried 3 ways to delete a record with a corupted memo field:

DoCmd.RunSQL "delete from
where MNAME ='" & strMNAME & "'"

returns err = 3709

Dim db As DAO.Database
Set db = CurrentDb()
db.Execute "DELETE FROM tablewhere MNAME ='" & strMNAME & "'",
dbFailOnError
db.Close
Set db = Nothing

returns err = 3709

Set conn = CurrentProject.Connection
Set rs = New ADODB.Recordset
rs.Open "table", conn, adOpenDynamic, adLockOptimistic
rs.Find "MNAME = '" & strMNAME & "'"
If Not rs.EOF Then rs.Delete
rs.Close
conn.Close

returns err = -2147217887

even manually deleting doesnt work. I have to copy the table and delete the
corupted one.

anything more brutal I could try in my code ?

henry
 
S

Stefan Hoffmann

hi Henry,
I tried 3 ways to delete a record with a corupted memo field:

DoCmd.RunSQL "delete from
where MNAME ='" & strMNAME & "'"
even manually deleting doesnt work. I have to copy the table and delete the
corupted one.

The only thing which will work in such situations is to copy the good
data into a new table:

a)
CurrentDb.Execute "SELECT * INTO New FROM Table WHERE 0=1", _
dbFailOnError

CurrentDb.Execute "INSERT INTO New SELECT * FROM Table WHERE ID<F", _
dbFailOnError

CurrentDb.Execute "INSERT INTO New SELECT * FROM Table WHERE ID>F", _
dbFailOnError


or

b)
CurrentDb.Execute "SELECT * INTO newTable FROM Table WHERE MNAME <> '" &
strMNAME & "'", dbFailOnError



mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top