一、演示下载
点击浏览该文件
二、代码:
Private Sub cmdSave_Click()
Dim rst As DAO.Recordset
'若title框没输入数据时提醒操作员
If IsNull(Me.title) Then
MsgBox "请输入标题", vbCritical, "提示"
Me.title.SetFocus
Exit Sub
End If
If IsNull(Me.content) Then
MsgBox "请输入内容", vbCritical, "提示"
Me.content.SetFocus
Exit Sub
End If
If IsNull(Me.saveID) Then
MsgBox "请选择保存方式", vbCritical, "提示"
Me.saveID.SetFocus
Exit Sub
End If
If IsNull(Me.SortID) Then
MsgBox "请选择大类", vbCritical, "提示"
Me.SortID.SetFocus
Exit Sub
End If
If IsNull(Me.subSortID) Then
MsgBox "请选择小类", vbCritical, "提示"
Me.subSortID.Enabled = True
Me.subSortID.SetFocus
Exit Sub
End If
If Me.saveID = "B" Then '如果是附件形式保存,就必须写下保存目录
If IsNull(Me.savePath) Then
MsgBox "请输入附件保存的路径", vbCritical, "提示"
Me.savePath.SetFocus
Exit Sub
End If
End If
If MsgBox("您确认要保存吗?", vbOKCancel + vbInformation, "提示") = vbOK Then
If Acchelp_StrDataIsExist("tblTiplist", "title", Me.title) = True Then
MsgBox "该技巧已存在,不允许保存!", vbCritical, "提示"
Else
Me.Refresh
Set rst = CurrentDb.OpenRecordset("tblTiplist", dbOpenDynaset)
rst.AddNew
rst("title") = Me.title
rst("content") = Me.content
rst("saveID") = Me.saveID
If Not IsNull(Me.savePath) Then
rst("savePath") = Me.savePath
&nbs