|
Function BakPath(str As String)
On Error GoTo Exit_Err
Dim rs As Recordset
Dim strSQL As String
Dim lng As Long
BakPath = False
strSQL = "select * from bak order by bak.id;"
Set rs = CurrentDb.OpenRecordset(strSQL)
If rs.RecordCount >= 10 Then
rs.MoveFirst
lng = rs("id")
Kill rs("bakpath")
DoCmd.SetWarnings False
DoCmd.RunSQL "delete * from bak where bak.id=" & lng & ";"
DoCmd.SetWarnings True
rs.addNew
rs("bakpath") = str
rs.Update
Else
rs.addNew
rs("bakpath") = str
rs.Update
End If
rs.Close
Set rs = Nothing
BakPath = True
Exit Function
Exit_Err:
MsgBox Err.Description
Exit Function
End Function
每次备份时将备份文件名添加到 表"BAK"中的"BakPath"字段中,如果BAK中的记录大于等于10
则移动到首记录,删除首记录中"BakPath"里的文件.并删除首记录,然后添加....更新记录
现在不知道哪里错了,无法实现,请指教 |
|