|
我使用的是简体系统 WIN2003 OFFICE2003
请提供帮忙,谢谢~
Private Sub 添加職員_Click()
On Error GoTo Err_添加職員_Click
Dim STemp As String
Dim Rs As String
Dim Rs As ADODB.Recordset
Set Rs = New ADODB.Recordset
STemp = "Select*From 員工資料"
Rs.Open STemp, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If Me![職員ID] <> "" And Me![部門ID] <> "" And Me![姓名] <> "" And Me![身份證ID] <> "" Then
Rs.AddNew
Rs("職員ID") = Me![職員ID]
Rs("部門ID") = Me![部門ID]
Rs("姓名") = Me![姓名]
Rs("性別") = Me![性別]
Rs("籍貫") = Me![籍貫]
Rs("年齡") = Me![年齡]
Rs("民族") = Me![民族]
Rs("身份證ID") = Me![身份證ID]
Rs("家庭地址") = Me![家庭地址]
Rs("家庭電話") = Me![家庭電話]
Rs("手機號碼") = Me![手機號碼]
Rs("QQ/MSN") = Me![QQ/MSN]
Rs("電子郵箱") = Me![電子郵箱]
Rs("備注") = Me![備注]
Rs.Update
MsgBox "員工檔案記錄已經添加成功!", vbOKOnly, "添加完成"
Else
MsgBox "窗體中必填文本和組合框不能爲空!", vbOKOnly, "警告"
Me![職員ID].SetFocus
End If
Me![員工資料 子窗體].Requery
Set Rs = Nothing
Exit_添加職員_Click:
Exit Sub
Err_添加職員_Click:
MsgBox Err.Description
Resume Exit_添加職員_Click
End Sub |
|