Private Sub saverecord_Click()
Dim aOk As Integer
Dim intid As Integer
Dim rst As New ADODB.Recordset
If 姓名.Value = "" Or 电话.Value = "" Then
MsgBox "输入的姓名和电话不能为空,请重新输入", vbOKOnly, "错误提示!"
姓名.SetFocus
Else
temp = "select * from 会员信息 "
rst.Open temp, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If rst.RecordCount > 0 Then
On Error GoTo errline
rst.AddNew
rst("姓名") = 姓名.Value
rst("电话") = 电话.Value
rst("办卡日期") = 日期.Value
rst("次数") = 次数.Value
rst("办卡内容") = 内容.Value
aOk = MsgBox("要确认添加吗?", vbOKCancel, "确认提示!")
If aOk = 1 Then
rst.Update
姓名.Value = ""
电话.Value = ""
日期.Value = ""
次数.Value = ""
内容.Value = ""
Else
rst.CancelUpdate
End If
End If
End If
会员管理子窗体.Requery
姓名.SetFocus
Exit Sub
errline:
MsgBox "输入的用户ID “" & Txt用户ID.Value & "” 不是整数!"
姓名.SetFocus
End Sub