Code:
Public Function Clean_Table()
Dim i As Integer, j As Variant
Dim Str(maxDataRows) As String, iFields As Integer
Set Rs = DB.OpenRecordset("SELECT * FROM " & sTable & " ORDER BY CH_ID")
i = 1
Do While Not Rs.EOF
Str(i) = "INSERT INTO `" & sTable & "` VALUES (" & i & " , '"
For iFields = 1 To Rs.Fieldcount - 1
Str(i) = Str(i) & Replace(Replace(Rs.Fields(iFields).Value, "\", "\\"), "'", "\'") & "'"
If iFields < Rs.Fieldcount - 1 Then
Str(i) = Str(i) & ", '"
End If
Next iFields
Str(i) = Str(i) & ")"
i = i + 1
Rs.MoveNext
Loop
Set Rs = DB.OpenRecordset("TRUNCATE TABLE " & sTable)
For Each j In Str
Set Rs = DB.OpenRecordset(j)
Call MySQL_Error
Next j
Call Update_Table
MsgBox "Datenbank gesäubert!", vbInformation, "OK"
End Function
das ist der sourcode.
wenn das recordset ein mysql-recordset is funktioniert es.
als normales "recordset" für access-dbs gibts dieses attribut aber ned.
jemand ne lösung dafür?